[PATCH] perf tools: Remove redundant code

Subsystems: performance events subsystem, the rest

STALE1975d

2 messages, 2 authors, 2021-03-11 · open the first message on its own page

[PATCH] perf tools: Remove redundant code

From: Jiapeng Chong <hidden>
Date: 2021-03-10 03:19:38

Fix the following coccicheck warnings:

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

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 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 882cd1f..6c2a271 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -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)
-- 
1.8.3.1

Re: [PATCH] perf tools: Remove redundant code

From: kajoljain <hidden>
Date: 2021-03-11 08:19:55


On 3/10/21 8:48 AM, Jiapeng Chong wrote:
quoted hunk
Fix the following coccicheck warnings:

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

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 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 882cd1f..6c2a271 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -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;
 }
Seems fine to me.

Reviewed-By: Kajol Jain<redacted>
Thanks,
Kajol Jain
 
 int evlist__open(struct evlist *evlist)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help