From 25ce4e7598e5ed6bdc268b8444a0ea88000eeb1b Mon Sep 17 00:00:00 2001 From: Minda Chen Date: Tue, 10 Oct 2023 17:10:18 +0800 Subject: 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 --- common/usb_hub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/usb_hub.c b/common/usb_hub.c index ba11a188ca..d0f4b8c2a7 100644 --- a/common/usb_hub.c +++ b/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; -- cgit v1.2.3