drivers: usb_dc_nrfx: check the device state before disable or uninit
Check the device state before nrfx_usbd_disable and nrfx_usbd_uninit. Otherwise it may lead to an ASSERT inside the HAL driver. Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
parent
38cc23a7d9
commit
cb37505976
1 changed files with 8 additions and 2 deletions
|
@ -1348,8 +1348,14 @@ int usb_dc_detach(void)
|
||||||
usbd_evt_flush();
|
usbd_evt_flush();
|
||||||
eps_ctx_uninit();
|
eps_ctx_uninit();
|
||||||
|
|
||||||
nrfx_usbd_disable();
|
if (nrfx_usbd_is_enabled()) {
|
||||||
nrfx_usbd_uninit();
|
nrfx_usbd_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nrfx_usbd_is_initialized()) {
|
||||||
|
nrfx_usbd_uninit();
|
||||||
|
}
|
||||||
|
|
||||||
(void) hf_clock_enable(false, false);
|
(void) hf_clock_enable(false, false);
|
||||||
nrf5_power_usb_power_int_enable(false);
|
nrf5_power_usb_power_int_enable(false);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue