usbhost: Make unplugging hubs more reliable.

USB drivers should not try control devices in the usbhost_disconnected
function. The control endpoint is NULL at this point because the device
has already been disconnected.

Before this change, the hub driver crashed when the child called
usbhost_hubpwr after the parent had already deactivated the control
pipe and set hport->ep0 to NULL.
This commit is contained in:
Lwazi Dube 2023-05-15 22:24:34 -04:00 committed by Xiang Xiao
parent 150680d677
commit 9948b5e701

View File

@ -1095,10 +1095,6 @@ static void usbhost_disconnect_event(FAR void *arg)
work_cancel(LPWORK, &priv->work); work_cancel(LPWORK, &priv->work);
/* Disable power to all downstream ports */
usbhost_hubpwr(priv, hport, false);
/* Free the allocated control request */ /* Free the allocated control request */
DRVR_FREE(hport->drvr, (FAR uint8_t *)priv->ctrlreq); DRVR_FREE(hport->drvr, (FAR uint8_t *)priv->ctrlreq);