call put_device() when device_register() fails. Signed-off-by: Rahul Ruikar <raul.ruikar@xxxxxxxxx> --- drivers/usb/gadget/fsl_udc_core.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 08a9a62..491fc7a 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -2340,8 +2340,10 @@ static int __init fsl_udc_probe(struct platform_device *pdev) udc_controller->gadget.dev.release = fsl_udc_release; udc_controller->gadget.dev.parent = &pdev->dev; ret = device_register(&udc_controller->gadget.dev); - if (ret < 0) + if (ret < 0) { + put_device(&udc_controller->gadget.dev); goto err_free_irq; + } /* setup QH and epctrl for ep0 */ ep0_setup(udc_controller); -- 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