提交 e2c34045 编写于 作者: R Rahul Ruikar 提交者: Felipe Balbi

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: NRahul Ruikar <rahul.ruikar@gmail.com>
Acked-by: NMing Lei <tom.leiming@gmail.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 9001d80d
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册