Skip to contentSkip to conversation

usb: gadget: at91_udc: Fix error path

PATCH New Rahul Ruikar 1 participant 1 message Oct 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: at91_udc: Fix error path

In function at91udc_probe()
call put_device() when device_register() fails.

---
 drivers/usb/gadget/at91_udc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/gadget/at91_udc.c +3 -1
index 93ead19..43178e5 100644
@@ -1798,8 +1798,10 @@ static int __init at91udc_probe(struct platform_device *pdev)
 	}
 
 	retval = device_register(&udc->gadget.dev);
-	if (retval < 0)
+	if (retval < 0) {
+		put_device(&udc->gadget.dev);
 		goto fail0b;
+	}
 
 	/* don't do anything until we have both gadget driver and VBUS */
 	clk_enable(udc->iclk);
Signature · 1 line
1.7.2.3