From: Ricardo Ribalda <ribalda@chromium.org>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ricardo Ribalda <ribalda@chromium.org>
Subject: [PATCH] tools/perf: Do not set a variable unless it will be used
Date: Fri, 4 Jun 2021 11:26:38 +0200 [thread overview]
Message-ID: <20210604092638.985694-1-ribalda@chromium.org> (raw)
clang-13 triggers the following warning:
bench/inject-buildid.c:351:6: error: variable 'len' set but not used [-Werror,-Wunused-but-set-variable]
u64 len = 0;
This patch sets the value to len only if it will be used afterwards.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
tools/perf/bench/inject-buildid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-buildid.c
index 55d373b75791..fee69ac787b2 100644
--- a/tools/perf/bench/inject-buildid.c
+++ b/tools/perf/bench/inject-buildid.c
@@ -348,13 +348,13 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss)
int status;
unsigned int i, k;
struct rusage rusage;
- u64 len = 0;
+ u64 len;
/* this makes the child to run */
if (perf_header__write_pipe(data->input_pipe[1]) < 0)
return -1;
- len += synthesize_attr(data);
+ len = synthesize_attr(data);
len += synthesize_fork(data);
for (i = 0; i < nr_mmaps; i++) {
--
2.32.0.rc1.229.g3e70b5a671-goog
next reply other threads:[~2021-06-04 9:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 9:26 Ricardo Ribalda [this message]
2021-06-04 9:36 ` Peter Zijlstra
2021-06-04 19:24 ` Ricardo Ribalda
2021-06-08 11:28 ` Peter Zijlstra
2021-06-09 14:15 ` Ricardo Ribalda
2021-06-08 11:12 ` David Laight
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=20210604092638.985694-1-ribalda@chromium.org \
--to=ribalda@chromium.org \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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®