* [PATCH] perf tools:remove unneeded variable from perf_event_attr__fprintf()
[not found] <20230614062234.24149-1-luojianhong@cdjrlc.com>
@ 2023-06-14 6:25 ` baomingtong001
2023-07-13 1:20 ` Ian Rogers
0 siblings, 1 reply; 3+ messages in thread
From: baomingtong001 @ 2023-06-14 6:25 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, irogers, adrian.hunter, anshuman.khandual
Cc: linux-perf-users, linux-kernel
fix the following coccicheck warning:
tools/perf/util/perf_event_attr_fprintf.c:97:5-8: Unneeded variable:
"ret". Return "0".
Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
---
tools/perf/util/perf_event_attr_fprintf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/perf/util/perf_event_attr_fprintf.c
b/tools/perf/util/perf_event_attr_fprintf.c
index 7e5e7b30510d..4a8f625b80c7 100644
--- a/tools/perf/util/perf_event_attr_fprintf.c
+++ b/tools/perf/util/perf_event_attr_fprintf.c
@@ -94,7 +94,6 @@ int perf_event_attr__fprintf(FILE *fp, struct
perf_event_attr *attr,
attr__fprintf_f attr__fprintf, void *priv)
{
char buf[BUF_SIZE];
- int ret = 0;
PRINT_ATTRf(type, p_unsigned);
PRINT_ATTRf(size, p_unsigned);
@@ -155,5 +154,5 @@ int perf_event_attr__fprintf(FILE *fp, struct
perf_event_attr *attr,
PRINT_ATTRf(aux_sample_size, p_unsigned);
PRINT_ATTRf(sig_data, p_unsigned);
- return ret;
+ return 0;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf tools:remove unneeded variable from perf_event_attr__fprintf()
2023-06-14 6:25 ` [PATCH] perf tools:remove unneeded variable from perf_event_attr__fprintf() baomingtong001
@ 2023-07-13 1:20 ` Ian Rogers
2024-01-03 21:19 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2023-07-13 1:20 UTC (permalink / raw)
To: baomingtong001
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, adrian.hunter, anshuman.khandual, linux-perf-users,
linux-kernel
On Tue, Jun 13, 2023 at 11:25 PM <baomingtong001@208suo.com> wrote:
>
> fix the following coccicheck warning:
>
> tools/perf/util/perf_event_attr_fprintf.c:97:5-8: Unneeded variable:
> "ret". Return "0".
>
> Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
Acked-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> ---
> tools/perf/util/perf_event_attr_fprintf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/perf_event_attr_fprintf.c
> b/tools/perf/util/perf_event_attr_fprintf.c
> index 7e5e7b30510d..4a8f625b80c7 100644
> --- a/tools/perf/util/perf_event_attr_fprintf.c
> +++ b/tools/perf/util/perf_event_attr_fprintf.c
> @@ -94,7 +94,6 @@ int perf_event_attr__fprintf(FILE *fp, struct
> perf_event_attr *attr,
> attr__fprintf_f attr__fprintf, void *priv)
> {
> char buf[BUF_SIZE];
> - int ret = 0;
>
> PRINT_ATTRf(type, p_unsigned);
> PRINT_ATTRf(size, p_unsigned);
> @@ -155,5 +154,5 @@ int perf_event_attr__fprintf(FILE *fp, struct
> perf_event_attr *attr,
> PRINT_ATTRf(aux_sample_size, p_unsigned);
> PRINT_ATTRf(sig_data, p_unsigned);
>
> - return ret;
> + return 0;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf tools:remove unneeded variable from perf_event_attr__fprintf()
2023-07-13 1:20 ` Ian Rogers
@ 2024-01-03 21:19 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-01-03 21:19 UTC (permalink / raw)
To: Ian Rogers
Cc: baomingtong001, peterz, mingo, mark.rutland, alexander.shishkin,
jolsa, namhyung, adrian.hunter, anshuman.khandual,
linux-perf-users, linux-kernel
Em Wed, Jul 12, 2023 at 06:20:12PM -0700, Ian Rogers escreveu:
> On Tue, Jun 13, 2023 at 11:25 PM <baomingtong001@208suo.com> wrote:
> >
> > fix the following coccicheck warning:
> >
> > tools/perf/util/perf_event_attr_fprintf.c:97:5-8: Unneeded variable:
> > "ret". Return "0".
> >
> > Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
>
> Acked-by: Ian Rogers <irogers@google.com>
util/perf_event_attr_fprintf.c: In function ‘perf_event_attr__fprintf’:
util/perf_event_attr_fprintf.c:256:17: error: ‘ret’ undeclared (first use in this function)
256 | ret += attr__fprintf(fp, _n, buf, priv);\
| ^~~
util/perf_event_attr_fprintf.c:267:9: note: in expansion of macro ‘PRINT_ATTRn’
267 | PRINT_ATTRn("type", type, p_type_id, true);
| ^~~~~~~~~~~
All those PRINT_ATTRf use that ret variable:
#define PRINT_ATTRn(_n, _f, _p, _a) \
do { \
if (_a || attr->_f) { \
_p(attr->_f); \
ret += attr__fprintf(fp, _n, buf, priv);\
} \
} while (0)
#define PRINT_ATTRf(_f, _p) PRINT_ATTRn(#_f, _f, _p, false
- Arnaldo
> Thanks,
> Ian
>
> > ---
> > tools/perf/util/perf_event_attr_fprintf.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/perf_event_attr_fprintf.c
> > b/tools/perf/util/perf_event_attr_fprintf.c
> > index 7e5e7b30510d..4a8f625b80c7 100644
> > --- a/tools/perf/util/perf_event_attr_fprintf.c
> > +++ b/tools/perf/util/perf_event_attr_fprintf.c
> > @@ -94,7 +94,6 @@ int perf_event_attr__fprintf(FILE *fp, struct
> > perf_event_attr *attr,
> > attr__fprintf_f attr__fprintf, void *priv)
> > {
> > char buf[BUF_SIZE];
> > - int ret = 0;
> >
> > PRINT_ATTRf(type, p_unsigned);
> > PRINT_ATTRf(size, p_unsigned);
> > @@ -155,5 +154,5 @@ int perf_event_attr__fprintf(FILE *fp, struct
> > perf_event_attr *attr,
> > PRINT_ATTRf(aux_sample_size, p_unsigned);
> > PRINT_ATTRf(sig_data, p_unsigned);
> >
> > - return ret;
> > + return 0;
> > }
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-03 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230614062234.24149-1-luojianhong@cdjrlc.com>
2023-06-14 6:25 ` [PATCH] perf tools:remove unneeded variable from perf_event_attr__fprintf() baomingtong001
2023-07-13 1:20 ` Ian Rogers
2024-01-03 21:19 ` 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).