usb: gadget: at91_udc: Fix error path
authorRahul Ruikar <rahul.ruikar@gmail.com>
Wed, 9 Feb 2011 12:44:28 +0000 (13:44 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 18:47:56 +0000 (10:47 -0800)
In function at91udc_probe()
call put_device() when device_register() fails.

Signed-off-by: Rahul Ruikar <rahul.ruikar@gmail.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/at91_udc.c

index bdec36acd0fa47373a4e32f046256284af045bdc..bb8ddf0469f904bc8326d74be5a4d8d54cf1bec9 100644 (file)
@@ -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);