mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 11:20:53 +07:00
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>
This commit is contained in:
parent
9001d80df9
commit
e2c3404523
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user