Skip to content

Commit 62277de

Browse files
Wei Yongjunrostedt
authored andcommitted
ring-buffer: Fix return value check in test_ringbuffer()
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/[email protected] Cc: [email protected] Fixes: 6c43e55 ("ring-buffer: Add ring buffer startup selftest") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent a71c9a1 commit 62277de

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/trace/ring_buffer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4826,9 +4826,9 @@ static __init int test_ringbuffer(void)
48264826
rb_data[cpu].cnt = cpu;
48274827
rb_threads[cpu] = kthread_create(rb_test, &rb_data[cpu],
48284828
"rbtester/%d", cpu);
4829-
if (WARN_ON(!rb_threads[cpu])) {
4829+
if (WARN_ON(IS_ERR(rb_threads[cpu]))) {
48304830
pr_cont("FAILED\n");
4831-
ret = -1;
4831+
ret = PTR_ERR(rb_threads[cpu]);
48324832
goto out_free;
48334833
}
48344834

@@ -4838,9 +4838,9 @@ static __init int test_ringbuffer(void)
48384838

48394839
/* Now create the rb hammer! */
48404840
rb_hammer = kthread_run(rb_hammer_test, NULL, "rbhammer");
4841-
if (WARN_ON(!rb_hammer)) {
4841+
if (WARN_ON(IS_ERR(rb_hammer))) {
48424842
pr_cont("FAILED\n");
4843-
ret = -1;
4843+
ret = PTR_ERR(rb_hammer);
48444844
goto out_free;
48454845
}
48464846

0 commit comments

Comments
 (0)