Skip to content

Commit

Permalink
usb: musb: musb_gadget: fix resource leakage in error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rahul Ruikar authored and Felipe Balbi committed Nov 5, 2010
1 parent 9001d80 commit e2c3404
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/musb/musb_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit e2c3404

Please sign in to comment.