Skip to contentSkip to conversation

perf dlfilter: Drop unused variable

PATCH In review Salvatore Bonaccorso 4 participants 6 messages Nov 23, 2021 – Dec 9, 2021 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf dlfilter: Drop unused variable

Compiling tools/perf/dlfilters/dlfilter-test-api-v0.c result in:

	checking for stdlib.h... dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
	dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]
	  311 |         struct filter_data *d = data;
	      |

So remove the variable now.

---
 tools/perf/dlfilters/dlfilter-test-api-v0.c | 2 --
 1 file changed, 2 deletions(-)
tools/perf/dlfilters/dlfilter-test-api-v0.c +0 -2
index 7565a1852c74..b17eb52a0694 100644
@@ -308,8 +308,6 @@ int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, vo
 
 int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx)
 {
-	struct filter_data *d = data;
-
 	pr_debug("%s API\n", __func__);
 
 	return do_checks(data, sample, ctx, false);
Signature · 1 line
2.34.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Salvatore Bonaccorso

Compiling tools/perf/dlfilters/dlfilter-test-api-v0.c result in:

	checking for stdlib.h... dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
	dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]
	  311 |         struct filter_data *d = data;
	      |

Did you get this warning when issuing "make"? From my side, it generated this gcc command so I didn't get it (make DEBUG=1):

  gcc -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c

Thanks,
German

Quoted 21 lines

So remove the variable now.

---
 tools/perf/dlfilters/dlfilter-test-api-v0.c | 2 --
 1 file changed, 2 deletions(-)
tools/perf/dlfilters/dlfilter-test-api-v0.c +0 -2
index 7565a1852c74..b17eb52a0694 100644
@@ -308,8 +308,6 @@ int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, vo
 
 int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx)
 {
-	struct filter_data *d = data;
-
 	pr_debug("%s API\n", __func__);
 
 	return do_checks(data, sample, ctx, false);
#2 lore raw

Hi German,

Quoted 9 lines · German Gomez
Quoted 6 lines · Salvatore Bonaccorso

Compiling tools/perf/dlfilters/dlfilter-test-api-v0.c result in:

	checking for stdlib.h... dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
	dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]
	  311 |         struct filter_data *d = data;
	      |
Quoted 6 lines

Did you get this warning when issuing "make"? From my side, it generated this gcc command so I didn't get it (make DEBUG=1):

  gcc -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c

Only when passing -Wall (this is the case when building the kernel packages in Debian with additional flags, so this is why this was spotted):

gcc -Wall -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]

  311 |         struct filter_data *d = data;
      |

Regards,
Salvatore

#3 lore raw

Em Wed, Dec 08, 2021 at 12:11:59PM +0100, Salvatore Bonaccorso escreveu:

Quoted 19 lines

Hi German,

Quoted 9 lines · German Gomez
Quoted 6 lines · Salvatore Bonaccorso

Compiling tools/perf/dlfilters/dlfilter-test-api-v0.c result in:

	checking for stdlib.h... dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
	dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]
	  311 |         struct filter_data *d = data;
	      |
Quoted 6 lines

Did you get this warning when issuing "make"? From my side, it generated this gcc command so I didn't get it (make DEBUG=1):

  gcc -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c

Quoted 9 lines

Only when passing -Wall (this is the case when building the kernel packages in Debian with additional flags, so this is why this was spotted):

gcc -Wall -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]

  311 |         struct filter_data *d = data;
      |

So I'm applying this, its an obvious cleanup, but please CC the author next time, I'm doing it in this reply, Adrian, ok?

- Arnaldo

reviewer
#4 lore raw
Quoted 30 lines · Arnaldo Carvalho de Melo

Em Wed, Dec 08, 2021 at 12:11:59PM +0100, Salvatore Bonaccorso escreveu:

Quoted 19 lines

Hi German,

Quoted 9 lines · German Gomez
Quoted 6 lines · Salvatore Bonaccorso

Compiling tools/perf/dlfilters/dlfilter-test-api-v0.c result in:

	checking for stdlib.h... dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
	dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]
	  311 |         struct filter_data *d = data;
	      |
Quoted 6 lines

Did you get this warning when issuing "make"? From my side, it generated this gcc command so I didn't get it (make DEBUG=1):

  gcc -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c

Quoted 9 lines

Only when passing -Wall (this is the case when building the kernel packages in Debian with additional flags, so this is why this was spotted):

gcc -Wall -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]

  311 |         struct filter_data *d = data;
      |
Quoted 2 lines

So I'm applying this, its an obvious cleanup, but please CC the author next time, I'm doing it in this reply, Adrian, ok?

Yes, thank you!

#5 lore raw
In reply to Arnaldo Carvalho de Melo

Hi,

Quoted 30 lines · Arnaldo Carvalho de Melo

Em Wed, Dec 08, 2021 at 12:11:59PM +0100, Salvatore Bonaccorso escreveu:

Quoted 19 lines

Hi German,

Quoted 9 lines · German Gomez
Quoted 6 lines · Salvatore Bonaccorso

Compiling tools/perf/dlfilters/dlfilter-test-api-v0.c result in:

	checking for stdlib.h... dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
	dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]
	  311 |         struct filter_data *d = data;
	      |
Quoted 6 lines

Did you get this warning when issuing "make"? From my side, it generated this gcc command so I didn't get it (make DEBUG=1):

  gcc -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c

Quoted 9 lines

Only when passing -Wall (this is the case when building the kernel packages in Debian with additional flags, so this is why this was spotted):

gcc -Wall -c -Iinclude  -o dlfilters/dlfilter-test-api-v0.o -fpic dlfilters/dlfilter-test-api-v0.c dlfilters/dlfilter-test-api-v0.c: In function ‘filter_event’:
dlfilters/dlfilter-test-api-v0.c:311:29: warning: unused variable ‘d’ [-Wunused-variable]

  311 |         struct filter_data *d = data;
      |
Quoted 2 lines

So I'm applying this, its an obvious cleanup, but please CC the author next time, I'm doing it in this reply, Adrian, ok?

Yes right, I apologies for that, something went wrong when I generated the list of people to contact using

./scripts/get_maintainer.pl ./tools/perf/dlfilters/dlfilter-test-api-v0.c

and write up the persons to contact.

Thank you!

Regards,
Salvatore