[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3118280595730def453e9ed89a16c9a8783490f3.1520747459.git.arvind.yadav.cs@gmail.com>
Date: Sun, 11 Mar 2018 11:25:49 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 2/4] 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@...il.com>
---
drivers/base/platform.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f1bf7b3..8075ddc 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);
--
2.7.4
Powered by blists - more mailing lists