Skip to content

Commit ddc8f6f

Browse files
davejiangjonmason
authored andcommitted
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 <dan.carpenter@oracle.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
1 parent 2572c7f commit ddc8f6f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/ntb/test/ntb_perf.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,17 +615,16 @@ static ssize_t debugfs_run_write(struct file *filp, const char __user *ubuf,
615615
kthread_create_on_node(ntb_perf_thread,
616616
(void *)pctx,
617617
node, "ntb_perf %d", i);
618-
if (pctx->thread)
619-
wake_up_process(pctx->thread);
620-
else {
618+
if (IS_ERR(pctx->thread)) {
621619
perf->run = false;
622620
for (i = 0; i < MAX_THREADS; i++) {
623621
if (pctx->thread) {
624622
kthread_stop(pctx->thread);
625623
pctx->thread = NULL;
626624
}
627625
}
628-
}
626+
} else
627+
wake_up_process(pctx->thread);
629628

630629
if (perf->run == false)
631630
return -ENXIO;

0 commit comments

Comments
 (0)