Skip to content
Permalink
Browse files

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>
  • Loading branch information...
jfischer-phytec-iot authored and ioannisg committed Jul 1, 2019
1 parent 38cc23a commit cb37505976e4e983cdc906efde055ce5fe2058c2
Showing with 8 additions and 2 deletions.
  1. +8 −2 drivers/usb/device/usb_dc_nrfx.c
@@ -1348,8 +1348,14 @@ int usb_dc_detach(void)
usbd_evt_flush();
eps_ctx_uninit();

nrfx_usbd_disable();
nrfx_usbd_uninit();
if (nrfx_usbd_is_enabled()) {
nrfx_usbd_disable();
}

if (nrfx_usbd_is_initialized()) {
nrfx_usbd_uninit();
}

(void) hf_clock_enable(false, false);
nrf5_power_usb_power_int_enable(false);

0 comments on commit cb37505

Please sign in to comment.
You can’t perform that action at this time.