From 8ab10400a037a516cc846c338f879e5bd62497ce Mon Sep 17 00:00:00 2001 From: Rahul Ruikar Date: Wed, 9 Feb 2011 13:44:28 +0100 Subject: [PATCH] usb: gadget: at91_udc: Fix error path In function at91udc_probe() call put_device() when device_register() fails. Signed-off-by: Rahul Ruikar Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/at91_udc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index bdec36acd0fa..bb8ddf0469f9 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -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); -- GitLab