提交 c8ae1674 编写于 作者: A Arvind Yadav 提交者: Greg Kroah-Hartman

driver core: platform: use put_device() if device_register fail

if device_register() returned an error! Always use put_device()
to give up the reference initialized.
Signed-off-by: NArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ef49ec1d
...@@ -1153,8 +1153,10 @@ int __init platform_bus_init(void) ...@@ -1153,8 +1153,10 @@ int __init platform_bus_init(void)
early_platform_cleanup(); early_platform_cleanup();
error = device_register(&platform_bus); error = device_register(&platform_bus);
if (error) if (error) {
put_device(&platform_bus);
return error; return error;
}
error = bus_register(&platform_bus_type); error = bus_register(&platform_bus_type);
if (error) if (error)
device_unregister(&platform_bus); device_unregister(&platform_bus);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册