Commit ab23a82a authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman

ring-buffer: Fix return value check in test_ringbuffer()

commit 62277de7 upstream.

In case of error, the function kthread_run() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Link: http://lkml.kernel.org/r/1466184839-14927-1-git-send-email-weiyj_lk@163.com

Fixes: 6c43e554 ("ring-buffer: Add ring buffer startup selftest")
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24d108e4
...@@ -4825,9 +4825,9 @@ static __init int test_ringbuffer(void) ...@@ -4825,9 +4825,9 @@ static __init int test_ringbuffer(void)
rb_data[cpu].cnt = cpu; rb_data[cpu].cnt = cpu;
rb_threads[cpu] = kthread_create(rb_test, &rb_data[cpu], rb_threads[cpu] = kthread_create(rb_test, &rb_data[cpu],
"rbtester/%d", cpu); "rbtester/%d", cpu);
if (WARN_ON(!rb_threads[cpu])) { if (WARN_ON(IS_ERR(rb_threads[cpu]))) {
pr_cont("FAILED\n"); pr_cont("FAILED\n");
ret = -1; ret = PTR_ERR(rb_threads[cpu]);
goto out_free; goto out_free;
} }
...@@ -4837,9 +4837,9 @@ static __init int test_ringbuffer(void) ...@@ -4837,9 +4837,9 @@ static __init int test_ringbuffer(void)
/* Now create the rb hammer! */ /* Now create the rb hammer! */
rb_hammer = kthread_run(rb_hammer_test, NULL, "rbhammer"); rb_hammer = kthread_run(rb_hammer_test, NULL, "rbhammer");
if (WARN_ON(!rb_hammer)) { if (WARN_ON(IS_ERR(rb_hammer))) {
pr_cont("FAILED\n"); pr_cont("FAILED\n");
ret = -1; ret = PTR_ERR(rb_hammer);
goto out_free; goto out_free;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment