call put_device() when device_register() fails. Signed-off-by: Rahul Ruikar <rahul.ruikar@xxxxxxxxx> --- drivers/usb/gadget/ci13xxx_udc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 6996951..f330833 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c @@ -2635,8 +2635,10 @@ static int udc_probe(struct device *dev, void __iomem *regs, const char *name) udc->gadget.dev.release = udc_release; retval = device_register(&udc->gadget.dev); - if (retval) + if (retval) { + put_device(&udc->gadget.dev); goto done; + } #ifdef CONFIG_USB_GADGET_DEBUG_FILES retval = dbg_create_files(&udc->gadget.dev); -- 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