Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8ae1674 authored by Arvind Yadav's avatar Arvind Yadav Committed by Greg Kroah-Hartman
Browse files

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: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef49ec1d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1153,8 +1153,10 @@ int __init platform_bus_init(void)
	early_platform_cleanup();

	error = device_register(&platform_bus);
	if (error)
	if (error) {
		put_device(&platform_bus);
		return error;
	}
	error =  bus_register(&platform_bus_type);
	if (error)
		device_unregister(&platform_bus);