Skip to content

Commit b191a18

Browse files
Thinh Nguyengregkh
authored andcommitted
usb: dwc3: gadget: Don't disconnect if not started
Don't go through soft-disconnection sequence if the controller hasn't started. Otherwise, there will be timeout and warning reports from the soft-disconnection flow. Cc: [email protected] Fixes: 61a3488 ("usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend") Reported-by: Marek Szyprowski <[email protected]> Closes: https://lore.kernel.org/linux-usb/[email protected]/T/#mb0661cd5f9272602af390c18392b9a36da4f96e6 Tested-by: Marek Szyprowski <[email protected]> Signed-off-by: Thinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/e3be9b929934e0680a6f4b8f6eb11b18ae9c7e07.1708043922.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5fd9e45 commit b191a18

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,11 @@ static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc)
26502650
int ret;
26512651

26522652
spin_lock_irqsave(&dwc->lock, flags);
2653+
if (!dwc->pullups_connected) {
2654+
spin_unlock_irqrestore(&dwc->lock, flags);
2655+
return 0;
2656+
}
2657+
26532658
dwc->connected = false;
26542659

26552660
/*

0 commit comments

Comments
 (0)