Messages in this thread Patch in this message | | | From | Arvind Yadav <> | Subject | [PATCH 2/4] driver core: platform: use put_device() if device_register fail | Date | Sun, 11 Mar 2018 11:25:49 +0530 |
| |
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> --- 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
| |