From 62d565ba088c7cd8976e00935de9f2097f6bdc2e Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 20 Mar 2020 09:38:02 +0100 Subject: 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 --- 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, -- cgit v1.2.3