In function udc_probe() call put_device() when device_register() fails. Signed-off-by: Rahul Ruikar <rahul.ruikar@xxxxxxxxx> --- drivers/usb/gadget/amd5536udc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 731150d4..950ee33 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c @@ -3382,8 +3382,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); -- 1.7.2.3 -- 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