From 49d3df53a80deed2251b91f50ae9e1c5caf7ded7 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Tue, 11 Jan 2011 09:19:21 +0530 Subject: [PATCH] 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: Pavankumar Kondeti Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/ci13xxx_udc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 31656a2b4ab4..b0b90621dc1b 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c @@ -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; @@ -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) { @@ -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); -- 2.39.5