Skip to content

Commit 537f414

Browse files
ArvindYadavCshtejun
authored andcommitted
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@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent fc6eabb commit 537f414

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/workqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5337,7 +5337,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
53375337

53385338
ret = device_register(&wq_dev->dev);
53395339
if (ret) {
5340-
kfree(wq_dev);
5340+
put_device(&wq_dev->dev);
53415341
wq->wq_dev = NULL;
53425342
return ret;
53435343
}

0 commit comments

Comments
 (0)