mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qing Wang <wangqing@vivo.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Cc: Wang Qing <wangqing@vivo.com>
Subject: [PATCH] trace: use WARN instead of printk and WARN_ON
Date: Tue,  7 Dec 2021 04:55:32 -0800	[thread overview]
Message-ID: <1638881732-3157-1-git-send-email-wangqing@vivo.com> (raw)

From: Wang Qing <wangqing@vivo.com>

Simply use WARN instead of printk(KERN_WARNING, ...) and WARN_ON.

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 kernel/trace/trace_output.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 3547e71..e0348ec
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -775,8 +775,7 @@ int register_trace_event(struct trace_event *event)
 		list_add_tail(&event->list, list);
 
 	} else if (event->type > __TRACE_LAST_TYPE) {
-		printk(KERN_WARNING "Need to add type to trace.h\n");
-		WARN_ON(1);
+		WARN(1, "Need to add type to trace.h\n");
 		goto out;
 	} else {
 		/* Is this event already used */
@@ -1569,11 +1568,9 @@ __init static int init_events(void)
 		event = events[i];
 
 		ret = register_trace_event(event);
-		if (!ret) {
-			printk(KERN_WARNING "event %d failed to register\n",
-			       event->type);
-			WARN_ON_ONCE(1);
-		}
+		if (!ret)
+			WARN_ONCE(1, "event %d failed to register\n",
+				  event->type);
 	}
 
 	return 0;
-- 
2.7.4


             reply	other threads:[~2021-12-07 12:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 12:55 Qing Wang [this message]
2021-12-07 14:18 ` Steven Rostedt
2022-04-24 12:09   ` [PATCH v2] " Guo Zhengkui
2022-04-24 13:19   ` Guo Zhengkui
     [not found] ` <AHoASQC9E8*4-sq3w2XY7ao3.9.1638886730256.Hmail.wangqing@vivo.com.@PDIwMjExMjA3MDkxODQzLjA3NjVmYTNmQGdhbmRhbGYubG9jYWwuaG9tZT4=>
2021-12-08  8:11   ` [PATCH] " 王擎

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1638881732-3157-1-git-send-email-wangqing@vivo.com \
    --to=wangqing@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®