[PATCH] driver core: Free memory obtained by kzalloc

From: Arvind Yadav
Date: Thu Mar 01 2018 - 01:00:18 EST


Here kfree() is taking NULL. So moving 'dev = NULL' after kfree().

Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
drivers/base/bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index ef61833..ccb64a0 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -1170,9 +1170,9 @@ static int subsys_register(struct bus_type *subsys,

err_dev_reg:
put_device(dev);
- dev = NULL;
err_name:
kfree(dev);
+ dev = NULL;
err_dev:
bus_unregister(subsys);
return err;
--
1.9.1