mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
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: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ef49ec1dc3
commit
c8ae1674cd
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue