usb: musb: musb_gadget: Fix error path
Subsystems (2)
PATCH 1/1 usb: musb: musb_gadget: Fix error path
In function musb_gadget_setup()
call put_device() when device_register() fails.
Signed-off-by Rahul Ruikar <[email protected]>
--- drivers/usb/musb/musb_gadget.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_gadget.c +3 -1
@@ -1676,8 +1676,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; }
Signature · 1 line
1.7.2.3
2010/10/2 Rahul Ruikar <[email protected]>:
Quoted 13 lines
In function
musb_gadget_setup()
callput_device()whendevice_register()fails.Signed-off-by Rahul Ruikar <[email protected]>---
drivers/usb/musb/musb_gadget.c | 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)drivers/usb/musb/musb_gadget.c +0
-0
drivers/usb/musb/musb_gadget.c int __init musb_gadget_setup(struct musb *musb) · line 1680
Quoted 6 lines
drivers/usb/musb/musb_gadget.c +2
-1@@ -1676,8 +1676,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);
This doe make sense, otherwise device_private may be leaked.
Quoted 9 lines
drivers/usb/musb/musb_gadget.c +1
-1the_gadget = NULL; + } return status; } --1.7.2.3
Acked-by Ming Lei <[email protected]>
Signature · 1 line
Lei Ming
Felipe Balbi
AppliedQuoted 4 lines · Rahul Ruikar
In function
musb_gadget_setup()
callput_device()whendevice_register()fails.Signed-off-by Rahul Ruikar <[email protected]>
applied, thanks
Signature · 1 line
balbi