提交 da01c7a4 编写于 作者: P Peter Korsgaard 提交者: Greg Kroah-Hartman

USB: g_hid: unregister platform driver on probe/usb_composite_register errors

Otherwise reloads will fail.
Signed-off-by: NPeter Korsgaard <peter.korsgaard@barco.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 fe662b43
......@@ -275,8 +275,18 @@ MODULE_LICENSE("GPL");
static int __init hidg_init(void)
{
platform_driver_probe(&hidg_plat_driver, hidg_plat_driver_probe);
return usb_composite_register(&hidg_driver);
int status;
status = platform_driver_probe(&hidg_plat_driver,
hidg_plat_driver_probe);
if (status < 0)
return status;
status = usb_composite_register(&hidg_driver);
if (status < 0)
platform_driver_unregister(&hidg_plat_driver);
return status;
}
module_init(hidg_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册