diff options
| author | Dave Jiang <dave.jiang@intel.com> | 2016-03-18 19:39:41 -0400 |
|---|---|---|
| committer | Jon Mason <jdmason@kudzu.us> | 2016-03-21 19:28:25 -0400 |
| commit | ddc8f6feec76b5deea8090db015920a283006044 (patch) | |
| tree | 09ab6f3e481b9e84f9bebc4693d7c74250835c31 | |
| parent | 2572c7fb4e4b941af9a0206ac8093d362ae6d371 (diff) | |
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>
| -rw-r--r-- | drivers/ntb/test/ntb_perf.c | 7 |
1 files changed, 3 insertions, 4 deletions
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, | |||
| 615 | kthread_create_on_node(ntb_perf_thread, | 615 | kthread_create_on_node(ntb_perf_thread, |
| 616 | (void *)pctx, | 616 | (void *)pctx, |
| 617 | node, "ntb_perf %d", i); | 617 | node, "ntb_perf %d", i); |
| 618 | if (pctx->thread) | 618 | if (IS_ERR(pctx->thread)) { |
| 619 | wake_up_process(pctx->thread); | ||
| 620 | else { | ||
| 621 | perf->run = false; | 619 | perf->run = false; |
| 622 | for (i = 0; i < MAX_THREADS; i++) { | 620 | for (i = 0; i < MAX_THREADS; i++) { |
| 623 | if (pctx->thread) { | 621 | if (pctx->thread) { |
| @@ -625,7 +623,8 @@ static ssize_t debugfs_run_write(struct file *filp, const char __user *ubuf, | |||
| 625 | pctx->thread = NULL; | 623 | pctx->thread = NULL; |
| 626 | } | 624 | } |
| 627 | } | 625 | } |
| 628 | } | 626 | } else |
| 627 | wake_up_process(pctx->thread); | ||
| 629 | 628 | ||
| 630 | if (perf->run == false) | 629 | if (perf->run == false) |
| 631 | return -ENXIO; | 630 | return -ENXIO; |
