linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf evlist: Directly return instead of using local ret variable
@ 2022-03-28  1:55 Haowen Bai
  2022-03-30 20:37 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Haowen Bai @ 2022-03-28  1:55 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, ast, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh
  Cc: linux-perf-users, linux-kernel, netdev, bpf, Haowen Bai

fixes coccinelle warning:
./tools/perf/util/evlist.c:1333:5-8: Unneeded variable: "err". Return
"- ENOMEM" on line 1358

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 tools/perf/util/evlist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 9bb79e0..1883278 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1330,7 +1330,6 @@ static int evlist__create_syswide_maps(struct evlist *evlist)
 {
 	struct perf_cpu_map *cpus;
 	struct perf_thread_map *threads;
-	int err = -ENOMEM;
 
 	/*
 	 * Try reading /sys/devices/system/cpu/online to get
@@ -1355,7 +1354,7 @@ static int evlist__create_syswide_maps(struct evlist *evlist)
 out_put:
 	perf_cpu_map__put(cpus);
 out:
-	return err;
+	return -ENOMEM;
 }
 
 int evlist__open(struct evlist *evlist)
-- 
2.7.4


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

* Re: [PATCH] perf evlist: Directly return instead of using local ret variable
  2022-03-28  1:55 [PATCH] perf evlist: Directly return instead of using local ret variable Haowen Bai
@ 2022-03-30 20:37 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-03-30 20:37 UTC (permalink / raw)
  To: Haowen Bai
  Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
	ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, linux-perf-users, linux-kernel, netdev, bpf

Em Mon, Mar 28, 2022 at 09:55:32AM +0800, Haowen Bai escreveu:
> fixes coccinelle warning:
> ./tools/perf/util/evlist.c:1333:5-8: Unneeded variable: "err". Return
> "- ENOMEM" on line 1358

Thanks, applied.

- Arnaldo

 
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
>  tools/perf/util/evlist.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 9bb79e0..1883278 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -1330,7 +1330,6 @@ static int evlist__create_syswide_maps(struct evlist *evlist)
>  {
>  	struct perf_cpu_map *cpus;
>  	struct perf_thread_map *threads;
> -	int err = -ENOMEM;
>  
>  	/*
>  	 * Try reading /sys/devices/system/cpu/online to get
> @@ -1355,7 +1354,7 @@ static int evlist__create_syswide_maps(struct evlist *evlist)
>  out_put:
>  	perf_cpu_map__put(cpus);
>  out:
> -	return err;
> +	return -ENOMEM;
>  }
>  
>  int evlist__open(struct evlist *evlist)
> -- 
> 2.7.4

-- 

- Arnaldo

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

end of thread, other threads:[~2022-03-30 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-28  1:55 [PATCH] perf evlist: Directly return instead of using local ret variable Haowen Bai
2022-03-30 20:37 ` 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).