workqueue: use put_device() instead of kfree()
PATCH v2 1/1 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 <[email protected]>
---
changes in v2:
Spell mistek in subject line "kfee -> kfree".
kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -1
@@ -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; }
Signature · 1 line
1.9.1
Quoted 5 lines · Arvind Yadav
Never directly free @dev after calling
device_register(), even if it returned an error! Always useput_device()to give up the reference initialized in this function instead.Signed-off-by Arvind Yadav <[email protected]>
Applied to wq/for-4.16-fixes.
Thanks.
Signature · 1 line
tejun