From: Rahul Ruikar Date: Sat, 2 Oct 2010 06:35:48 +0000 (-0500) Subject: usb: musb: musb_gadget: fix resource leakage in error path X-Git-Tag: v3.12-rc1~8174^2~12^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2c3404523c5366c6cc1099d3237d363254adde0;p=kernel%2Fkernel-generic.git 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 Acked-by: Ming Lei Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index ce31f07..ba22e4a 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) musb_platform_try_idle(musb, 0); status = device_register(&musb->g.dev); - if (status != 0) + if (status != 0) { + put_device(&musb->g.dev); the_gadget = NULL; + } return status; }