diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-03-20 09:38:02 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-03-26 07:21:15 +0100 |
commit | 62d565ba088c7cd8976e00935de9f2097f6bdc2e (patch) | |
tree | b99704a44edee7c9f50a80d079e5f206d7b15075 | |
parent | 1f8c8af48f54c129570e34e05f09ab904a868e98 (diff) | |
download | barebox-62d565ba088c7cd8976e00935de9f2097f6bdc2e.tar.gz barebox-62d565ba088c7cd8976e00935de9f2097f6bdc2e.tar.xz |
usb: hub: When no connection came up remove from scanning list
When after a timeout no connection came up then we have not only bail
out, but also remove the device from the scanning list. Otherwise it
can happen that the list never becomes empty and we probe forever.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/usb/core/hub.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 9954c0568f..2ac4184969 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -339,8 +339,9 @@ static void usb_scan_port(struct usb_device_scan *usb_scan) dev_dbg(&dev->dev, "port%d: Status 0x%04x Change 0x%04x\n", port + 1, portstatus, portchange); - if (!(portchange & USB_PORT_STAT_C_CONNECTION)) { - if(get_time_ns() >= hub->connect_timeout) { + if (!(portchange & USB_PORT_STAT_C_CONNECTION) || + !(portstatus & USB_PORT_STAT_CONNECTION)) { + if (get_time_ns() >= hub->connect_timeout) { dev_dbg(&dev->dev, "port%d: timeout\n", port + 1); /* Remove this device from scanning list */ goto remove; @@ -348,10 +349,6 @@ static void usb_scan_port(struct usb_device_scan *usb_scan) return; } - /* Test if the connection came up, and if not exit */ - if(!(portstatus & USB_PORT_STAT_CONNECTION)) - return; - if (portchange & USB_PORT_STAT_C_RESET) { dev_dbg(&dev->dev, "port%d: reset change\n", port + 1); usb_clear_port_feature(dev, port + 1, |