Procházet zdrojové kódy

usb: hub: Do NOT add device if portchanged over current bit is set

USB hub should not add the usb devices if over current bit
is set in portchange. For later usb_scan_port will still return
with error and rescan and add device again.
it will generate dulplicated device and cause crash issue.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Minda Chen před 7 měsíci
rodič
revize
25ce4e7598
1 změnil soubory, kde provedl 3 přidání a 0 odebrání
  1. 3 0
      common/usb_hub.c

+ 3 - 0
common/usb_hub.c

@@ -376,6 +376,9 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
 		return ret;
 	}
 
+	if (le16_to_cpu(portsts->wPortChange) & USB_PORT_STAT_C_OVERCURRENT)
+		return -EIO;
+
 	switch (portstatus & USB_PORT_STAT_SPEED_MASK) {
 	case USB_PORT_STAT_SUPER_SPEED:
 		speed = USB_SPEED_SUPER;