From ddc8f6feec76b5deea8090db015920a283006044 Mon Sep 17 00:00:00 2001 From: Dave Jiang Date: Fri, 18 Mar 2016 16:39:41 -0700 Subject: NTB: Fix incorrect return check in ntb_perf kthread_create_no_node() returns error pointers, never NULL. Fix check so it handles error correctly. Reported-by: Dan Carpenter Signed-off-by: Dave Jiang Signed-off-by: Jon Mason --- drivers/ntb/test/ntb_perf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/ntb') diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c index cf19ff07680d..d82d10791e7d 100644 --- a/drivers/ntb/test/ntb_perf.c +++ b/drivers/ntb/test/ntb_perf.c @@ -615,9 +615,7 @@ static ssize_t debugfs_run_write(struct file *filp, const char __user *ubuf, kthread_create_on_node(ntb_perf_thread, (void *)pctx, node, "ntb_perf %d", i); - if (pctx->thread) - wake_up_process(pctx->thread); - else { + if (IS_ERR(pctx->thread)) { perf->run = false; for (i = 0; i < MAX_THREADS; i++) { if (pctx->thread) { @@ -625,7 +623,8 @@ static ssize_t debugfs_run_write(struct file *filp, const char __user *ubuf, pctx->thread = NULL; } } - } + } else + wake_up_process(pctx->thread); if (perf->run == false) return -ENXIO; -- cgit v1.2.3-59-g8ed1b