Skip to contentSkip to conversation

tracing: Fix return value check in trace_benchmark_reg()

PATCH New Wei Yongjun 1 participant 1 message Jan 12, 2017 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Fix return value check in trace_benchmark_reg()

From: Wei Yongjun <[email protected]>

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

---
 kernel/trace/trace_benchmark.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_benchmark.c +2 -2
index e3b4888..e49fbe9 100644
@@ -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;