Re: [PATCH] aoe: remove unnecessary check for failing kthread creation

From: Ed Cashin
Date: Tue Feb 02 2016 - 20:38:20 EST


On 02/01/2016 10:53 AM, Insu Yun wrote:
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)

Thanks, the change looks reasonable.

...
task = kthread_run(kthread, k, "%s", k->name);
- 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.

--
Ed