From: Rahul Ruikar <rahul.ruikar@xxxxxxxxx> In function udc_probe() call put_device() when device_register() fails. Signed-off-by: Rahul Ruikar <rahul.ruikar@xxxxxxxxx> Acked-by: Thomas Dahlmann <dahlmann.thomas@xxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Cc: David Brownell <david-b@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/usb/gadget/amd5536udc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -puN drivers/usb/gadget/amd5536udc.c~drivers-usb-gadget-amd5536udcc-fix-error-path drivers/usb/gadget/amd5536udc.c --- a/drivers/usb/gadget/amd5536udc.c~drivers-usb-gadget-amd5536udcc-fix-error-path +++ a/drivers/usb/gadget/amd5536udc.c @@ -3383,8 +3383,10 @@ static int udc_probe(struct udc *dev) udc = dev; retval = device_register(&dev->gadget.dev); - if (retval) + if (retval) { + put_device(&dev->gadget.dev); goto finished; + } /* timer init */ init_timer(&udc_timer); _ -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html