linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] perf stat: remove redundant variable in  arch_get_topdown_pmu_name
@ 2022-11-23  9:00 zhang.songyi
  2022-11-23 23:33 ` Ian Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: zhang.songyi @ 2022-11-23  9:00 UTC (permalink / raw)
  To: peterz, zhengjun.xing
  Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung,
	kan.liang, irogers, zhang.songyi, adrian.hunter, linux-perf-users,
	linux-kernel

From: zhang songyi <zhang.songyi@zte.com.cn>

Return value from arch_get_topdown_pmu_name directly instead of taking
this in another redundant variable.

Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>
---
 tools/perf/arch/x86/util/topdown.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/perf/arch/x86/util/topdown.c b/tools/perf/arch/x86/util/topdown.c
index 54810f9acd6f..5a5cdd6efe4d 100644
--- a/tools/perf/arch/x86/util/topdown.c
+++ b/tools/perf/arch/x86/util/topdown.c
@@ -84,8 +84,6 @@ bool arch_topdown_sample_read(struct evsel *leader)

 const char *arch_get_topdown_pmu_name(struct evlist *evlist, bool warn)
 {
-       const char *pmu_name;
-
        if (!perf_pmu__has_hybrid())
                return "cpu";

@@ -95,9 +93,7 @@ const char *arch_get_topdown_pmu_name(struct evlist *evlist, bool warn)
                evlist->hybrid_pmu_name = perf_pmu__hybrid_type_to_pmu("core");
        }

-       pmu_name = evlist->hybrid_pmu_name;
-
-       return pmu_name;
+       return evlist->hybrid_pmu_name;
 }

 int topdown_parse_events(struct evlist *evlist)
--
2.15.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] perf stat: remove redundant variable in arch_get_topdown_pmu_name
  2022-11-23  9:00 [PATCH linux-next] perf stat: remove redundant variable in arch_get_topdown_pmu_name zhang.songyi
@ 2022-11-23 23:33 ` Ian Rogers
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2022-11-23 23:33 UTC (permalink / raw)
  To: zhang.songyi
  Cc: peterz, zhengjun.xing, mingo, acme, mark.rutland,
	alexander.shishkin, jolsa, namhyung, kan.liang, adrian.hunter,
	linux-perf-users, linux-kernel

On Wed, Nov 23, 2022 at 1:01 AM <zhang.songyi@zte.com.cn> wrote:
>
> From: zhang songyi <zhang.songyi@zte.com.cn>
>
> Return value from arch_get_topdown_pmu_name directly instead of taking
> this in another redundant variable.
>
> Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>

Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/arch/x86/util/topdown.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/tools/perf/arch/x86/util/topdown.c b/tools/perf/arch/x86/util/topdown.c
> index 54810f9acd6f..5a5cdd6efe4d 100644
> --- a/tools/perf/arch/x86/util/topdown.c
> +++ b/tools/perf/arch/x86/util/topdown.c
> @@ -84,8 +84,6 @@ bool arch_topdown_sample_read(struct evsel *leader)
>
>  const char *arch_get_topdown_pmu_name(struct evlist *evlist, bool warn)
>  {
> -       const char *pmu_name;
> -
>         if (!perf_pmu__has_hybrid())
>                 return "cpu";
>
> @@ -95,9 +93,7 @@ const char *arch_get_topdown_pmu_name(struct evlist *evlist, bool warn)
>                 evlist->hybrid_pmu_name = perf_pmu__hybrid_type_to_pmu("core");
>         }
>
> -       pmu_name = evlist->hybrid_pmu_name;
> -
> -       return pmu_name;
> +       return evlist->hybrid_pmu_name;
>  }
>
>  int topdown_parse_events(struct evlist *evlist)
> --
> 2.15.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-23 23:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23  9:00 [PATCH linux-next] perf stat: remove redundant variable in arch_get_topdown_pmu_name zhang.songyi
2022-11-23 23:33 ` Ian Rogers

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).