aoe: remove unnecessary check for failing kthread creation
Subsystems (2)
PATCH 1/1 aoe: remove unnecessary check for failing kthread creation
When kthread_run fails, it returns ERR, not NULL.
Therefore, NULL checking is redundant.
(https://www.kernel.org/doc/htmldocs/device-drivers/API-kthread-run.html)
--- drivers/block/aoe/aoecmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/aoe/aoecmd.c +1 -1
@@ -1327,7 +1327,7 @@ aoe_ktstart(struct ktstate *k)init_completion (&k->rendez); task =kthread_run (kthread, k,"%s" , k->name); -if (task ==NULL ||IS_ERR (task)) +if (IS_ERR (task))return -ENOMEM ; k->task = task;wait_for_completion (&k->rendez);/* allow kthread to start */
Signature · 1 line
1.9.1
Quoted 3 lines · Insu Yun
When
kthread_runfails, it returns ERR, not NULL.
Therefore, NULL checking is redundant.
(https://www.kernel.org/doc/htmldocs/device-drivers/API-kthread-run.html)
Thanks, the change looks reasonable.
...
drivers/block/aoe/aoecmd.c aoe_ktstart(struct ktstate *k) · line 1331
Quoted 4 lines
task = kthread_run(kthread, k, "%s", k->name);drivers/block/aoe/aoecmd.c +1
-1-if (task ==NULL ||IS_ERR (task)) +if (IS_ERR (task))return -ENOMEM ;
Interestingly, after this change, it's more clear that returning -ENOMEM is a bit misleading when the underlying kernel/kthread.c function, kthread_create_on_node returns ERR_PTR(-EINTR). But because that would happen when the process we need to have the driver working gets killed, I'm not sure it matters.
Signature · 1 line
Ed