lkml.org 
[lkml]   [2020]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded()
Em Thu, Sep 03, 2020 at 03:53:01PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Sep 02, 2020 at 10:05:26PM +0800, YueHaibing escreveu:
> > In case of error, the function perf_session__new() returns ERR_PTR()
> > and never returns NULL. The NULL test in the return value check
> > should be replaced with IS_ERR()
> >
> > Fixes: 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>
> Thanks, applied, kudos for adding the Fixes: tag, appreciated!

But...

> > ---
> > tools/perf/bench/synthesize.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/bench/synthesize.c b/tools/perf/bench/synthesize.c
> > index 8d624aea1c5e..e39daa609db2 100644
> > --- a/tools/perf/bench/synthesize.c
> > +++ b/tools/perf/bench/synthesize.c
> > @@ -162,8 +162,8 @@ static int do_run_multi_threaded(struct target *target,
> > init_stats(&event_stats);
> > for (i = 0; i < multi_iterations; i++) {
> > session = perf_session__new(NULL, false, NULL);
> > - if (!session)
> > - return -ENOMEM;
> > + if (IS_ERR(session)) {
> > + return PTR_ERR(session);

This doesn't compile, so I take back that kudo ;-\

I'm fixing this by removing that needless '{'.

Please be more careful,

- Arnaldo

> >
> > atomic_set(&event_count, 0);
> > gettimeofday(&start, NULL);
> > --
> > 2.17.1
> >
> >
>
> --
>
> - Arnaldo

--

- Arnaldo

\
 
 \ /
  Last update: 2020-09-03 20:55    [W:0.059 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site