Skip to content

Commit

Permalink
NTB: Fix incorrect return check in ntb_perf
Browse files Browse the repository at this point in the history
kthread_create_no_node() returns error pointers, never NULL. Fix check so
it handles error correctly.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
  • Loading branch information
Dave Jiang authored and Jon Mason committed Mar 21, 2016
1 parent 2572c7f commit ddc8f6f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/ntb/test/ntb_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,17 +615,16 @@ 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) {
kthread_stop(pctx->thread);
pctx->thread = NULL;
}
}
}
} else
wake_up_process(pctx->thread);

if (perf->run == false)
return -ENXIO;
Expand Down

0 comments on commit ddc8f6f

Please sign in to comment.