Commit f362a475 authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

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 <david-b@pacbell.net>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 550a7375
...@@ -1710,17 +1710,15 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ...@@ -1710,17 +1710,15 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
spin_unlock_irqrestore(&musb->lock, flags); spin_unlock_irqrestore(&musb->lock, flags);
if (retval == 0) if (retval == 0) {
retval = driver->bind(&musb->g); retval = driver->bind(&musb->g);
if (retval != 0) { if (retval != 0) {
DBG(3, "bind to driver %s failed --> %d\n", DBG(3, "bind to driver %s failed --> %d\n",
driver->driver.name, retval); driver->driver.name, retval);
musb->gadget_driver = NULL; musb->gadget_driver = NULL;
musb->g.dev.driver = NULL; musb->g.dev.driver = NULL;
} }
/* start peripheral and/or OTG engines */
if (retval == 0) {
spin_lock_irqsave(&musb->lock, flags); spin_lock_irqsave(&musb->lock, flags);
/* REVISIT always use otg_set_peripheral(), handling /* REVISIT always use otg_set_peripheral(), handling
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment