[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1520330743-20445-1-git-send-email-arvind.yadav.cs@gmail.com>
Date: Tue, 6 Mar 2018 15:35:43 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: tj@...nel.org, jiangshanlai@...il.com
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH v2] workqueue: use put_device() instead of kfree()
Never directly free @dev after calling device_register(), even
if it returned an error! Always use put_device() to give up the
reference initialized in this function instead.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
---
changes in v2:
Spell mistek in subject line "kfee -> kfree".
kernel/workqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index bb9a519..ccd1080 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5337,7 +5337,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
ret = device_register(&wq_dev->dev);
if (ret) {
- kfree(wq_dev);
+ put_device(&wq_dev->dev);
wq->wq_dev = NULL;
return ret;
}
--
1.9.1
Powered by blists - more mailing lists