From: Steven Rostedt <rostedt@goodmis.org>
To: Qing Wang <wangqing@vivo.com>
Cc: Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] trace: use WARN instead of printk and WARN_ON
Date: Tue, 7 Dec 2021 09:18:43 -0500 [thread overview]
Message-ID: <20211207091843.0765fa3f@gandalf.local.home> (raw)
In-Reply-To: <1638881732-3157-1-git-send-email-wangqing@vivo.com>
On Tue, 7 Dec 2021 04:55:32 -0800
Qing Wang <wangqing@vivo.com> wrote:
> 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");
If you are going to fix this, then please fix it properly.
} else if (WARN(event->type > __TRACE_LAST_TYPE,
"Need to add type to trace.h")) {
> 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);
And this should just turn into:
WARN_ONCE(!ret, "event %d failed to register", event->type);
-- Steve
> }
>
> return 0;
next prev parent reply other threads:[~2021-12-07 14:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 12:55 Qing Wang
2021-12-07 14:18 ` Steven Rostedt [this message]
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=20211207091843.0765fa3f@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=wangqing@vivo.com \
/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®