Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323272 > unrolled thread

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

Started byInsu Yun <wuninsu@gmail.com>
First post2016-02-01 17:00 +0100
Last post2016-02-03 02:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] aoe: remove unnecessary check for failing kthread creation Insu Yun <wuninsu@gmail.com> - 2016-02-01 17:00 +0100
    Re: [PATCH] aoe: remove unnecessary check for failing kthread  creation Ed Cashin <ed.cashin@acm.org> - 2016-02-03 02:40 +0100

#1323272 — [PATCH] aoe: remove unnecessary check for failing kthread creation

FromInsu Yun <wuninsu@gmail.com>
Date2016-02-01 17:00 +0100
Subject[PATCH] aoe: remove unnecessary check for failing kthread creation
Message-ID<qXp3t-50K-23@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


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

FromEd Cashin <ed.cashin@acm.org>
Date2016-02-03 02:40 +0100
SubjectRe: [PATCH] aoe: remove unnecessary check for failing kthread creation
Message-ID<qXUAi-3B6-17@gated-at.bofh.it>
In reply to#1323272
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web