aboutsummaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorArvind Yadav2018-03-11 11:25:49 +0530
committerGreg Kroah-Hartman2018-03-15 14:37:04 +0100
commitc8ae1674cd0d688661a8b85b8b2d940516933322 (patch)
treeb663b1e6fe1085a0eed8303920537234fec895a4 /drivers/base
parentef49ec1dc35112b17f7e928aa08fcab60240bf1d (diff)
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/platform.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f1bf7b38d91c..8075ddc70a17 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -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);