From f34c25ed78df6d1297db2187bf5e58aaf6674183 Mon Sep 17 00:00:00 2001 From: Rahul Ruikar Date: Wed, 20 Oct 2010 16:01:51 -0700 Subject: USB: gadget: amd5536udc.c: fix error path In function udc_probe() call put_device() when device_register() fails. Signed-off-by: Rahul Ruikar Acked-by: Thomas Dahlmann Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/amd5536udc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 2b361500af1e..9034e0344723 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/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); -- cgit v1.2.3