Skip to content

Commit

Permalink
usb: gadget: at91_udc: Fix error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rahul Ruikar authored and Greg Kroah-Hartman committed Feb 17, 2011
1 parent b14e840 commit 8ab1040
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/gadget/at91_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8ab1040

Please sign in to comment.