diff --git a/class/hub/usbh_hub.c b/class/hub/usbh_hub.c index 7feb3001..4aa6be0f 100644 --- a/class/hub/usbh_hub.c +++ b/class/hub/usbh_hub.c @@ -706,8 +706,6 @@ int usbh_hub_deinitialize(struct usbh_bus *bus) struct usbh_hub *hub; size_t flags; - flags = usb_osal_enter_critical_section(); - hub = &bus->hcd.roothub; for (uint8_t port = 0; port < hub->nports; port++) { hport = &hub->child[port]; @@ -715,6 +713,8 @@ int usbh_hub_deinitialize(struct usbh_bus *bus) usbh_hubport_release(hport); } + flags = usb_osal_enter_critical_section(); + usb_hc_deinit(bus); usb_osal_leave_critical_section(flags);