From: Steven Rostedt <rostedt@goodmis.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: Remove redundant assignment to event_var
Date: Fri, 7 May 2021 09:16:25 -0400 [thread overview]
Message-ID: <20210507091625.0bcccf43@gandalf.local.home> (raw)
In-Reply-To: <1620383030-70462-1-git-send-email-jiapeng.chong@linux.alibaba.com>
On Fri, 7 May 2021 18:23:50 +0800
Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:
> Variable event_var is set to 'ERR_PTR(-EINVAL)', but this value
> is never read as it is overwritten or not used later on, hence
> it is a redundant assignment and can be removed.
>
> Clean up the following clang-analyzer warning:
>
> kernel/trace/trace_events_hist.c:2437:21: warning: Value stored to
> 'event_var' during its initialization is never read
> [clang-analyzer-deadcode.DeadStores].
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> kernel/trace/trace_events_hist.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index c1abd63..b37342c 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -2434,7 +2434,7 @@ static struct trace_event_file *event_file(struct trace_array *tr,
> char *subsys_name, char *event_name, char *field_name)
> {
> struct trace_array *tr = target_hist_data->event_file->tr;
> - struct hist_field *event_var = ERR_PTR(-EINVAL);
> + struct hist_field *event_var;
> struct hist_trigger_data *hist_data;
> unsigned int i, n, first = true;
> struct field_var_hist *var_hist;
Thanks, but if you are going to make this change, please move the
declaration of event_var below (or above) key_field, as their names are
both the same size in length and are of the same type. This keeps the
"upside-down x-mas tree" look of the declarations.
-- Steve
prev parent reply other threads:[~2021-05-07 13:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-07 10:23 Jiapeng Chong
2021-05-07 13:16 ` Steven Rostedt [this message]
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=20210507091625.0bcccf43@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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®