Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddc8f6fe authored by Dave Jiang's avatar Dave Jiang Committed by Jon Mason
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
parent 2572c7fb
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -615,9 +615,7 @@ static ssize_t debugfs_run_write(struct file *filp, const char __user *ubuf,
				kthread_create_on_node(ntb_perf_thread,
				kthread_create_on_node(ntb_perf_thread,
						       (void *)pctx,
						       (void *)pctx,
						       node, "ntb_perf %d", i);
						       node, "ntb_perf %d", i);
			if (pctx->thread)
			if (IS_ERR(pctx->thread)) {
				wake_up_process(pctx->thread);
			else {
				perf->run = false;
				perf->run = false;
				for (i = 0; i < MAX_THREADS; i++) {
				for (i = 0; i < MAX_THREADS; i++) {
					if (pctx->thread) {
					if (pctx->thread) {
@@ -625,7 +623,8 @@ static ssize_t debugfs_run_write(struct file *filp, const char __user *ubuf,
						pctx->thread = NULL;
						pctx->thread = NULL;
					}
					}
				}
				}
			}
			} else
				wake_up_process(pctx->thread);


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