public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aoe: remove unnecessary check for failing kthread creation
@ 2016-02-01 15:53 Insu Yun
  2016-02-03  1:31 ` Ed Cashin
  0 siblings, 1 reply; 2+ messages in thread
From: Insu Yun @ 2016-02-01 15:53 UTC (permalink / raw)
  To: ed.cashin, linux-kernel; +Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun

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)

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/block/aoe/aoecmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index d048d20..4213114 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -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 */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] aoe: remove unnecessary check for failing kthread creation
  2016-02-01 15:53 [PATCH] aoe: remove unnecessary check for failing kthread creation Insu Yun
@ 2016-02-03  1:31 ` Ed Cashin
  0 siblings, 0 replies; 2+ messages in thread
From: Ed Cashin @ 2016-02-03  1:31 UTC (permalink / raw)
  To: Insu Yun, linux-kernel; +Cc: taesoo, yeongjin.jang, insu, changwoo

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-03  1:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-01 15:53 [PATCH] aoe: remove unnecessary check for failing kthread creation Insu Yun
2016-02-03  1:31 ` Ed Cashin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox