From: tangmeng <tangmeng@uniontech.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@redhat.com, namhyung@kernel.org
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
tangmeng <tangmeng@uniontech.com>
Subject: [PATCH 2/2] perf tools: Remove redundant err variable
Date: Wed, 16 Feb 2022 11:04:25 +0800 [thread overview]
Message-ID: <20220216030425.27779-2-tangmeng@uniontech.com> (raw)
In-Reply-To: <20220216030425.27779-1-tangmeng@uniontech.com>
The variable err in the perf_event__process_sample is only used
in the only one judgment statement, it is not used in other places.
So, use the return value from hist_entry_iter__add() directly
instead of taking this in another redundant variable.
Signed-off-by: tangmeng <tangmeng@uniontech.com>
---
tools/perf/builtin-top.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 1fc390f136dd..3c8c60b7f6f0 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -746,7 +746,6 @@ static void perf_event__process_sample(struct perf_tool *tool,
{
struct perf_top *top = container_of(tool, struct perf_top, tool);
struct addr_location al;
- int err;
if (!machine && perf_guest) {
static struct intlist *seen;
@@ -839,8 +838,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
pthread_mutex_lock(&hists->lock);
- err = hist_entry_iter__add(&iter, &al, top->max_stack, top);
- if (err < 0)
+ if (hist_entry_iter__add(&iter, &al, top->max_stack, top) < 0)
pr_err("Problem incrementing symbol period, skipping event\n");
pthread_mutex_unlock(&hists->lock);
--
2.20.1
next prev parent reply other threads:[~2022-02-16 3:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 3:04 [PATCH 1/2] perf tools: Remove redundant ret variable tangmeng
2022-02-16 3:04 ` tangmeng [this message]
2022-02-16 13:38 ` [PATCH 2/2] perf tools: Remove redundant err variable Arnaldo Carvalho de Melo
2022-02-16 13:39 ` [PATCH 1/2] perf tools: Remove redundant ret variable Arnaldo Carvalho de Melo
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=20220216030425.27779-2-tangmeng@uniontech.com \
--to=tangmeng@uniontech.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--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®