[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1520490204-10411-1-git-send-email-arvind.yadav.cs@gmail.com>
Date: Thu, 8 Mar 2018 11:53:24 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: m@...s.ch
Cc: linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org
Subject: [PATCH v3] ssb: use put_device() if device_register fail
Never directly free @dev after calling device_register(), even
if it returned an error! Always use put_device() to give up the
reference initialized.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
---
changes in v2:
Removed kfree() call for @dev.
changes in v3:
Add put_device() in place of kfree().
drivers/ssb/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 65420a9..e732fd3 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -522,7 +522,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
/* Set dev to NULL to not unregister
* dev on error unwinding. */
sdev->dev = NULL;
- kfree(devwrap);
+ put_device(dev);
goto error;
}
dev_idx++;
--
1.9.1
Powered by blists - more mailing lists