Skip to contentSkip to conversation

tracing: Use WARN(1,...)

PATCH NAK Xu Wang 2 participants 2 messages Feb 26, 2021 Tracing

lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 tracing: Use WARN(1,...)

Use WARN(1,...) rather than printk followed by WARN_ON(1).

---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 526fd5ac2ba8..a556b8c00a9f 100644
@@ -1957,7 +1957,7 @@ static int run_tracer_selftest(struct tracer *type)
 	tr->current_trace = saved_tracer;
 	if (ret) {
 		/* Add the warning after printing 'FAILED' */
-		WARN(1, KERN_CONT "FAILED!\n");
+		WARN(1, "FAILED!\n");
 		return -1;
 	}
 	/* Only reset on passing, to avoid touching corrupted buffers */
Signature · 1 line
2.17.1
maintainer NAK
#1 lore raw
Quoted 1 line · On Fri, 26 Feb 2021 09:44:26 +0000 Xu Wang <[email protected]> wrote:

Use WARN(1,...) rather than printk followed by WARN_ON(1).

Why?

Quoted 11 lines
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +0 -0
index 526fd5ac2ba8..a556b8c00a9f 100644

kernel/trace/trace.c static int run_tracer_selftest(struct tracer *type) · line 1960

Quoted 5 lines
kernel/trace/trace.c +1 -1
@@ -1957,7 +1957,7 @@ static int run_tracer_selftest(struct tracer *type)
 	tr->current_trace = saved_tracer;
 	if (ret) {
 		/* Add the warning after printing 'FAILED' */
-		WARN(1, KERN_CONT "FAILED!\n");
+		WARN(1, "FAILED!\n");

The above isn't even in my tree.

Anyway, look at the code around it, and then tell that this patch makes sense.

NAK.

-- Steve

Quoted 3 lines
kernel/trace/trace.c +0 -0
 		return -1;
 	}
 	/* Only reset on passing, to avoid touching corrupted buffers */