Commit 49d3df53 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Greg Kroah-Hartman

USB: gadget: Fix error path in ci13xxx_udc gadget probe function

Don't call gadget driver's unbind when bind is failed.  Initialize
udc->driver only after gadget driver bind is successful.  Otherwise
pull-up can be enabled upon VBUS session even when no gadget is
bounded.
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 15680cdf
...@@ -2427,7 +2427,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, ...@@ -2427,7 +2427,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
info("hw_ep_max = %d", hw_ep_max); info("hw_ep_max = %d", hw_ep_max);
udc->driver = driver;
udc->gadget.dev.driver = NULL; udc->gadget.dev.driver = NULL;
retval = 0; retval = 0;
...@@ -2479,6 +2478,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, ...@@ -2479,6 +2478,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
goto done; goto done;
} }
udc->driver = driver;
pm_runtime_get_sync(&udc->gadget.dev); pm_runtime_get_sync(&udc->gadget.dev);
if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) { if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) {
if (udc->vbus_active) { if (udc->vbus_active) {
...@@ -2496,8 +2496,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, ...@@ -2496,8 +2496,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
done: done:
spin_unlock_irqrestore(udc->lock, flags); spin_unlock_irqrestore(udc->lock, flags);
if (retval)
usb_gadget_unregister_driver(driver);
return retval; return retval;
} }
EXPORT_SYMBOL(usb_gadget_probe_driver); EXPORT_SYMBOL(usb_gadget_probe_driver);
......
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