Skip to content

Commit f362a47

Browse files
Felipe Balbigregkh
authored andcommitted
usb: musb: fix hanging when rmmod gadget driver
If we try to modprobe a second gadget driver before rmmoding the first one, the reference for the first gadget driver would get NULLed avoiding usb to change gadget drivers later. Cc: David Brownell <[email protected]> Cc: Tony Lindgren <[email protected]> Signed-off-by: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 550a737 commit f362a47

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/usb/musb/musb_gadget.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,17 +1710,15 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
17101710

17111711
spin_unlock_irqrestore(&musb->lock, flags);
17121712

1713-
if (retval == 0)
1713+
if (retval == 0) {
17141714
retval = driver->bind(&musb->g);
1715-
if (retval != 0) {
1716-
DBG(3, "bind to driver %s failed --> %d\n",
1717-
driver->driver.name, retval);
1718-
musb->gadget_driver = NULL;
1719-
musb->g.dev.driver = NULL;
1720-
}
1715+
if (retval != 0) {
1716+
DBG(3, "bind to driver %s failed --> %d\n",
1717+
driver->driver.name, retval);
1718+
musb->gadget_driver = NULL;
1719+
musb->g.dev.driver = NULL;
1720+
}
17211721

1722-
/* start peripheral and/or OTG engines */
1723-
if (retval == 0) {
17241722
spin_lock_irqsave(&musb->lock, flags);
17251723

17261724
/* REVISIT always use otg_set_peripheral(), handling

0 commit comments

Comments
 (0)