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.ha...@pengutronix.de>
---
 drivers/usb/core/hub.c | 9 +++------
 1 file 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,
-- 
2.26.0.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to