Skip to contentSkip to conversation

perf tools: Remove redundant code

PATCH In review Jiapeng Chong 2 participants 2 messages Mar 10, 2021 – Mar 11, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: Remove redundant code

Fix the following coccicheck warnings:

./tools/perf/util/evlist.c:1315:5-8: Unneeded variable: "err". Return "- ENOMEM" on line 1340.

---
 tools/perf/util/evlist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evlist.c +1 -2
index 882cd1f..6c2a271 100644
@@ -1313,7 +1313,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
@@ -1338,7 +1337,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)
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Jiapeng Chong

Fix the following coccicheck warnings:

./tools/perf/util/evlist.c:1315:5-8: Unneeded variable: "err". Return "- ENOMEM" on line 1340.

---
 tools/perf/util/evlist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evlist.c +0 -1
index 882cd1f..6c2a271 100644
@@ -1313,7 +1313,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

tools/perf/util/evlist.c static int evlist__create_syswide_maps(struct evlist *evlist) · line 1341

Quoted 6 lines
tools/perf/util/evlist.c +1 -1
@@ -1338,7 +1337,7 @@ static int evlist__create_syswide_maps(struct evlist *evlist)
 out_put:
 	perf_cpu_map__put(cpus);
 out:
-	return err;
+	return -ENOMEM;
 }

Seems fine to me.

Thanks,
Kajol Jain

Quoted 3 lines
tools/perf/util/evlist.c +0 -0
 int evlist__open(struct evlist *evlist)