diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 9b8d28f2eb4d29..59f7e2cc1409c8 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3583,9 +3583,11 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, port_status |= USB_PORT_STAT_C_OVERCURRENT << 16; } - if (dwc2_is_device_mode(hsotg)) { + if (!hsotg->flags.b.port_connect_status) { /* - * Just return 0's for the remainder of the port status + * The port is disconnected, which means the core is + * either in device mode or it soon will be. Just + * return 0's for the remainder of the port status * since the port register can't be read if the core * is in device mode. */ @@ -3655,11 +3657,13 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, if (wvalue != USB_PORT_FEAT_TEST && (!windex || windex > 1)) goto error; - if (dwc2_is_device_mode(hsotg)) { + if (!hsotg->flags.b.port_connect_status) { /* - * Just return 0's for the remainder of the port status - * since the port register can't be read if the core - * is in device mode. + * The port is disconnected, which means the core is + * either in device mode or it soon will be. Just + * return without doing anything since the port + * register can't be written if the core is in device + * mode. */ break; }