Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557468 > unrolled thread

[PATCH -next] tracing: Fix return value check in trace_benchmark_reg()

Started byWei Yongjun <weiyj.lk@gmail.com>
First post2017-01-12 15:00 +0100
Last post2017-01-12 15:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] tracing: Fix return value check in trace_benchmark_reg() Wei Yongjun <weiyj.lk@gmail.com> - 2017-01-12 15:00 +0100

#1557468 — [PATCH -next] tracing: Fix return value check in trace_benchmark_reg()

FromWei Yongjun <weiyj.lk@gmail.com>
Date2017-01-12 15:00 +0100
Subject[PATCH -next] tracing: Fix return value check in trace_benchmark_reg()
Message-ID<sYO54-4DI-15@gated-at.bofh.it>
From: Wei Yongjun <weiyongjun1@huawei.com>

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().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 kernel/trace/trace_benchmark.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c
index e3b4888..e49fbe9 100644
--- a/kernel/trace/trace_benchmark.c
+++ b/kernel/trace/trace_benchmark.c
@@ -175,9 +175,9 @@ int trace_benchmark_reg(void)
 
 	bm_event_thread = kthread_run(benchmark_event_kthread,
 				      NULL, "event_benchmark");
-	if (!bm_event_thread) {
+	if (IS_ERR(bm_event_thread)) {
 		pr_warning("trace benchmark failed to create kernel thread\n");
-		return -ENOMEM;
+		return PTR_ERR(bm_event_thread);
 	}
 
 	return 0;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web