[<prev] [next>] [day] [month] [year] [list]
Message-Id: <6ea392ae58fb06df5c1548ae804bb4d842dbd049.1520330391.git.arvind.yadav.cs@gmail.com>
Date: Tue, 6 Mar 2018 15:31:03 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: tj@...nel.org, jiangshanlai@...il.com
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] workqueue: use put_device() instead of kfee()
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>
---
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