tools/perf/builtin-trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
The alloc_syscall_stats() function always returns an error pointer
(ERR_PTR) on failure. So replace NULL check with IS_ERR() check
after calling alloc_syscall_stats() function.
Fixes: fc00897c8a3f ("perf trace: Add --summary-mode option")
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
tools/perf/builtin-trace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index fe737b3ac6e6..25c41b89f8ab 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -4440,7 +4440,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (trace->summary_mode == SUMMARY__BY_TOTAL && !trace->summary_bpf) {
trace->syscall_stats = alloc_syscall_stats();
- if (trace->syscall_stats == NULL)
+ if (IS_ERR(trace->syscall_stats))
goto out_delete_evlist;
}
@@ -4748,7 +4748,7 @@ static int trace__replay(struct trace *trace)
if (trace->summary_mode == SUMMARY__BY_TOTAL) {
trace->syscall_stats = alloc_syscall_stats();
- if (trace->syscall_stats == NULL)
+ if (IS_ERR(trace->syscall_stats))
goto out;
}
--
2.36.1
On Wed, Sep 17, 2025 at 2:54 AM Fushuai Wang <wangfushuai@baidu.com> wrote: > > The alloc_syscall_stats() function always returns an error pointer > (ERR_PTR) on failure. So replace NULL check with IS_ERR() check > after calling alloc_syscall_stats() function. > > Fixes: fc00897c8a3f ("perf trace: Add --summary-mode option") > Signed-off-by: Fushuai Wang <wangfushuai@baidu.com> Reviewed-by: Ian Rogers <irogers@google.com> Thanks, Ian > --- > tools/perf/builtin-trace.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c > index fe737b3ac6e6..25c41b89f8ab 100644 > --- a/tools/perf/builtin-trace.c > +++ b/tools/perf/builtin-trace.c > @@ -4440,7 +4440,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) > > if (trace->summary_mode == SUMMARY__BY_TOTAL && !trace->summary_bpf) { > trace->syscall_stats = alloc_syscall_stats(); > - if (trace->syscall_stats == NULL) > + if (IS_ERR(trace->syscall_stats)) > goto out_delete_evlist; > } > > @@ -4748,7 +4748,7 @@ static int trace__replay(struct trace *trace) > > if (trace->summary_mode == SUMMARY__BY_TOTAL) { > trace->syscall_stats = alloc_syscall_stats(); > - if (trace->syscall_stats == NULL) > + if (IS_ERR(trace->syscall_stats)) > goto out; > } > > -- > 2.36.1 >
On Wed, Sep 17, 2025 at 08:31:02AM -0700, Ian Rogers wrote: > On Wed, Sep 17, 2025 at 2:54 AM Fushuai Wang <wangfushuai@baidu.com> wrote: > > > > The alloc_syscall_stats() function always returns an error pointer > > (ERR_PTR) on failure. So replace NULL check with IS_ERR() check > > after calling alloc_syscall_stats() function. > > > > Fixes: fc00897c8a3f ("perf trace: Add --summary-mode option") > > Signed-off-by: Fushuai Wang <wangfushuai@baidu.com> > > Reviewed-by: Ian Rogers <irogers@google.com> Thanks, applied to perf-tools-next, - Arnaldo
© 2016 - 2025 Red Hat, Inc.