* [PATCH 1/2] perf tools: Remove redundant ret variable
@ 2022-02-16 3:04 tangmeng
2022-02-16 3:04 ` [PATCH 2/2] perf tools: Remove redundant err variable tangmeng
2022-02-16 13:39 ` [PATCH 1/2] perf tools: Remove redundant ret variable Arnaldo Carvalho de Melo
0 siblings, 2 replies; 4+ messages in thread
From: tangmeng @ 2022-02-16 3:04 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung
Cc: linux-perf-users, linux-kernel, tangmeng
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-annotate.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 490bb9b8cf17..e347b8ef088f 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -190,7 +190,6 @@ static int process_branch_callback(struct evsel *evsel,
};
struct addr_location a;
- int ret;
if (machine__resolve(machine, &a, sample) < 0)
return -1;
@@ -203,8 +202,7 @@ static int process_branch_callback(struct evsel *evsel,
hist__account_cycles(sample->branch_stack, al, sample, false, NULL);
- ret = hist_entry_iter__add(&iter, &a, PERF_MAX_STACK_DEPTH, ann);
- return ret;
+ return hist_entry_iter__add(&iter, &a, PERF_MAX_STACK_DEPTH, ann);
}
static bool has_annotation(struct perf_annotate *ann)
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] perf tools: Remove redundant err variable
2022-02-16 3:04 [PATCH 1/2] perf tools: Remove redundant ret variable tangmeng
@ 2022-02-16 3:04 ` tangmeng
2022-02-16 13:38 ` Arnaldo Carvalho de Melo
2022-02-16 13:39 ` [PATCH 1/2] perf tools: Remove redundant ret variable Arnaldo Carvalho de Melo
1 sibling, 1 reply; 4+ messages in thread
From: tangmeng @ 2022-02-16 3:04 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung
Cc: linux-perf-users, linux-kernel, tangmeng
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] perf tools: Remove redundant err variable
2022-02-16 3:04 ` [PATCH 2/2] perf tools: Remove redundant err variable tangmeng
@ 2022-02-16 13:38 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-02-16 13:38 UTC (permalink / raw)
To: tangmeng
Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
linux-perf-users, linux-kernel
Em Wed, Feb 16, 2022 at 11:04:25AM +0800, tangmeng escreveu:
> 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.
Thanks, applied.
- Arnaldo
> 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
>
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] perf tools: Remove redundant ret variable
2022-02-16 3:04 [PATCH 1/2] perf tools: Remove redundant ret variable tangmeng
2022-02-16 3:04 ` [PATCH 2/2] perf tools: Remove redundant err variable tangmeng
@ 2022-02-16 13:39 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-02-16 13:39 UTC (permalink / raw)
To: tangmeng
Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
linux-perf-users, linux-kernel
Em Wed, Feb 16, 2022 at 11:04:24AM +0800, tangmeng escreveu:
> Return value from hist_entry_iter__add() directly instead
> of taking this in another redundant variable.
Thanks, applied.
- Arnaldo
> Signed-off-by: tangmeng <tangmeng@uniontech.com>
> ---
> tools/perf/builtin-annotate.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
> index 490bb9b8cf17..e347b8ef088f 100644
> --- a/tools/perf/builtin-annotate.c
> +++ b/tools/perf/builtin-annotate.c
> @@ -190,7 +190,6 @@ static int process_branch_callback(struct evsel *evsel,
> };
>
> struct addr_location a;
> - int ret;
>
> if (machine__resolve(machine, &a, sample) < 0)
> return -1;
> @@ -203,8 +202,7 @@ static int process_branch_callback(struct evsel *evsel,
>
> hist__account_cycles(sample->branch_stack, al, sample, false, NULL);
>
> - ret = hist_entry_iter__add(&iter, &a, PERF_MAX_STACK_DEPTH, ann);
> - return ret;
> + return hist_entry_iter__add(&iter, &a, PERF_MAX_STACK_DEPTH, ann);
> }
>
> static bool has_annotation(struct perf_annotate *ann)
> --
> 2.20.1
>
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-16 13:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 3:04 [PATCH 1/2] perf tools: Remove redundant ret variable tangmeng
2022-02-16 3:04 ` [PATCH 2/2] perf tools: Remove redundant err variable tangmeng
2022-02-16 13:38 ` Arnaldo Carvalho de Melo
2022-02-16 13:39 ` [PATCH 1/2] perf tools: Remove redundant ret variable Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).