Skip to contentSkip to conversation

perf bench: remove unneeded variable

PATCH In review [email protected] 3 participants 3 messages Jun 14, 2023 1 message not in the archive perf events

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 perf bench: remove unneeded variable

fix the following coccicheck warning:

tools/perf/bench/find-bit-bench.c:127:5-8: Unneeded variable: "err". Return "0".

---
 tools/perf/bench/find-bit-bench.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/find-bit-bench.c +2 -2
index 7e25b0e413f6..70619bc73841 100644
@@ -124,7 +124,7 @@ static int do_for_each_set_bit(unsigned int num_bits)
 
 int bench_mem_find_bit(int argc, const char **argv)
 {
-    int err = 0, i;
+    int i;
 
     argc = parse_options(argc, argv, options, bench_usage, 0);
     if (argc) {
@@ -135,5 +135,5 @@ int bench_mem_find_bit(int argc, const char **argv)
     for (i = 1; i <= 2048; i <<= 1)
         do_for_each_set_bit(i);
 
-    return err;
+    return 0;
 }
reviewer Reviewed-by on v1 1/1
#2 lore raw
Quoted 7 lines · On Tue, Jun 13, 2023 at 8:38 PM <[email protected]> wrote:

fix the following coccicheck warning:

tools/perf/bench/find-bit-bench.c:127:5-8: Unneeded variable: "err". Return "0".

Thanks,
Ian

Quoted 26 lines
---
  tools/perf/bench/find-bit-bench.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/find-bit-bench.c +1 -1
index 7e25b0e413f6..70619bc73841 100644
@@ -124,7 +124,7 @@ static int do_for_each_set_bit(unsigned int
 num_bits)
 
  int bench_mem_find_bit(int argc, const char **argv)
  {
-    int err = 0, i;
+    int i;
 
      argc = parse_options(argc, argv, options, bench_usage, 0);
      if (argc) {
tools/perf/bench/find-bit-bench.c +1 -1
@@ -135,5 +135,5 @@ int bench_mem_find_bit(int argc, const char **argv)
      for (i = 1; i <= 2048; i <<= 1)
          do_for_each_set_bit(i);
 
-    return err;
+    return 0;
  }
#3 lore raw
In reply to [email protected]

Em Wed, Jun 14, 2023 at 11:38:41AM +0800, [email protected] escreveu:

Quoted 4 lines

fix the following coccicheck warning:

tools/perf/bench/find-bit-bench.c:127:5-8: Unneeded variable: "err". Return "0".

⬢[acme@toolbox perf-tools-next]$ patch -p1 < ~/wb/1.patch patching file tools/perf/bench/find-bit-bench.c
patch: **** malformed patch at line 117: num_bits)

⬢[acme@toolbox perf-tools-next]$

Please check the process you're following to generate and send the patch.

There is a doc file for that...

Documentation/process/submitting-patches.rst

Well, two:

Documentation/process/submit-checklist.rst

I'm applying this manually,

Thanks,

- Arnaldo

Quoted 26 lines
---
 tools/perf/bench/find-bit-bench.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/find-bit-bench.c +2 -2
index 7e25b0e413f6..70619bc73841 100644
@@ -124,7 +124,7 @@ static int do_for_each_set_bit(unsigned int num_bits)
 
 int bench_mem_find_bit(int argc, const char **argv)
 {
-    int err = 0, i;
+    int i;
 
     argc = parse_options(argc, argv, options, bench_usage, 0);
     if (argc) {
@@ -135,5 +135,5 @@ int bench_mem_find_bit(int argc, const char **argv)
     for (i = 1; i <= 2048; i <<= 1)
         do_for_each_set_bit(i);
 
-    return err;
+    return 0;
 }
Signature · 1 line
- Arnaldo