Skip to content

Commit

Permalink
USB: gadget: Fix error path in ci13xxx_udc gadget probe function
Browse files Browse the repository at this point in the history
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: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Pavankumar Kondeti authored and Greg Kroah-Hartman committed Jan 23, 2011
1 parent 15680cd commit 49d3df5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/usb/gadget/ci13xxx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2427,7 +2427,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,

info("hw_ep_max = %d", hw_ep_max);

udc->driver = driver;
udc->gadget.dev.driver = NULL;

retval = 0;
Expand Down Expand Up @@ -2479,6 +2478,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
goto done;
}

udc->driver = driver;
pm_runtime_get_sync(&udc->gadget.dev);
if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) {
if (udc->vbus_active) {
Expand All @@ -2496,8 +2496,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,

done:
spin_unlock_irqrestore(udc->lock, flags);
if (retval)
usb_gadget_unregister_driver(driver);
return retval;
}
EXPORT_SYMBOL(usb_gadget_probe_driver);
Expand Down

0 comments on commit 49d3df5

Please sign in to comment.