Patchwork usb: gadget: fsl_udc_core: Fix error path

login
register
mail settings
Submitter Rahul Ruikar
Date Oct. 2, 2010, 5:41 a.m.
Message ID <1285998096-3385-1-git-send-email-rahul.ruikar@gmail.com>
Download mbox | patch
Permalink /patch/66557/
State Deferred
Delegated to: Kumar Gala
Headers show

Comments

Rahul Ruikar - Oct. 2, 2010, 5:41 a.m.
call put_device() when device_register() fails.

Signed-off-by: Rahul Ruikar <raul.ruikar@gmail.com>
---
 drivers/usb/gadget/fsl_udc_core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 08a9a62..491fc7a 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2340,8 +2340,10 @@  static int __init fsl_udc_probe(struct platform_device *pdev)
 	udc_controller->gadget.dev.release = fsl_udc_release;
 	udc_controller->gadget.dev.parent = &pdev->dev;
 	ret = device_register(&udc_controller->gadget.dev);
-	if (ret < 0)
+	if (ret < 0) {
+		put_device(&udc_controller->gadget.dev);
 		goto err_free_irq;
+	}
 
 	/* setup QH and epctrl for ep0 */
 	ep0_setup(udc_controller);