aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorRahul Ruikar <rahul.ruikar@gmail.com>2010-10-02 02:35:48 -0400
committerFelipe Balbi <balbi@ti.com>2010-11-05 07:43:14 -0400
commite2c3404523c5366c6cc1099d3237d363254adde0 (patch)
tree36a6a04dd5420819299f3c9c092dc39cdbf97943 /drivers/usb
parent9001d80df9b1db946ef5d0fb52c974d74c567b86 (diff)
usb: musb: musb_gadget: fix resource leakage in error path
In function musb_gadget_setup() call put_device() when device_register() fails. Signed-off-by: Rahul Ruikar <rahul.ruikar@gmail.com> Acked-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/musb/musb_gadget.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index ce31f079b31e..ba22e4a20f95 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1705,8 +1705,10 @@ int __init musb_gadget_setup(struct musb *musb)
1705 musb_platform_try_idle(musb, 0); 1705 musb_platform_try_idle(musb, 0);
1706 1706
1707 status = device_register(&musb->g.dev); 1707 status = device_register(&musb->g.dev);
1708 if (status != 0) 1708 if (status != 0) {
1709 put_device(&musb->g.dev);
1709 the_gadget = NULL; 1710 the_gadget = NULL;
1711 }
1710 return status; 1712 return status;
1711} 1713}
1712 1714