perf bench: fix return value check in do_run_multi_threaded()
PATCH 1/1 perf bench: fix return value check in do_run_multi_threaded()
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()
--- tools/perf/bench/synthesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/synthesize.c +2 -2
@@ -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);atomic_set (&event_count,0 );gettimeofday (&start,NULL );
Signature · 1 line
2.17.1
Quoted 7 lines · YueHaibing
In case of error, the function
perf_session__new()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR()Fixes 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")Signed-off-by YueHaibing <[email protected]>
Thanks!
Ian
Quoted 23 lines
--- tools/perf/bench/synthesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/bench/synthesize.c +2
-3@@ -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);atomic_set (&event_count,0 );gettimeofday (&start,NULL ); --2.17.1
Em Wed, Sep 02, 2020 at 10:05:26PM +0800, YueHaibing escreveu:
Quoted 6 lines
In case of error, the function
perf_session__new()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR()Fixes 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")Signed-off-by YueHaibing <[email protected]>
Thanks, applied, kudos for adding the Fixes: tag, appreciated!
- Arnaldo
Quoted 23 lines
--- tools/perf/bench/synthesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/bench/synthesize.c +2
-2@@ -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);atomic_set (&event_count,0 );gettimeofday (&start,NULL );Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Arnaldo Carvalho de Melo
maintainerEm Thu, Sep 03, 2020 at 03:53:01PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 9 lines
Em Wed, Sep 02, 2020 at 10:05:26PM +0800, YueHaibing escreveu:
Quoted 6 lines
In case of error, the function
perf_session__new()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR()Fixes 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")Signed-off-by YueHaibing <[email protected]>Thanks, applied, kudos for adding the Fixes: tag, appreciated!
But...
Quoted 4 lines
Quoted 4 lines
--- tools/perf/bench/synthesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines
tools/perf/bench/synthesize.c static int do_run_multi_threaded(struct target *target, · line 166
Quoted 12 lines
tools/perf/bench/synthesize.c +2
-2@@ -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
Quoted 11 lines
Quoted 7 lines
tools/perf/bench/synthesize.c +0
-0atomic_set (&event_count,0 );gettimeofday (&start,NULL );Signature · 1 line
2.17.1Signature · 1 line
- Arnaldo
Signature · 1 line
- Arnaldo
Arnaldo Carvalho de Melo
maintainerEm Thu, Sep 03, 2020 at 03:54:51PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 32 lines
Em Thu, Sep 03, 2020 at 03:53:01PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 9 lines
Em Wed, Sep 02, 2020 at 10:05:26PM +0800, YueHaibing escreveu:
Quoted 6 lines
In case of error, the function
perf_session__new()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR()Fixes 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")Signed-off-by YueHaibing <[email protected]>Thanks, applied, kudos for adding the Fixes: tag, appreciated!
But...
Quoted 4 lines
Quoted 4 lines
--- tools/perf/bench/synthesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
tools/perf/bench/synthesize.c static int do_run_multi_threaded(struct target *target, · line 166
Quoted 12 lines
tools/perf/bench/synthesize.c +2
-2@@ -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 ;-\
Quoted 1 line
I'm fixing this by removing that needless '{'.
tools/perf/bench/synthesize.c +1 -1
@@ -162,7 +162,7 @@ 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 (IS_ERR (session)) { +if (IS_ERR (session))return PTR_ERR (session);atomic_set (&event_count,0 );
Quoted 13 lines · Arnaldo Carvalho de Melo
Em Thu, Sep 03, 2020 at 03:54:51PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 12 lines
Em Thu, Sep 03, 2020 at 03:53:01PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 9 lines
Em Wed, Sep 02, 2020 at 10:05:26PM +0800, YueHaibing escreveu:
Quoted 6 lines
In case of error, the function
perf_session__new()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR()Fixes 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")Signed-off-by YueHaibing <[email protected]>Thanks, applied, kudos for adding the Fixes: tag, appreciated!
But...
OOps, sorry for this, I'll pay attention next time.
Quoted 38 lines
Quoted 21 lines
Quoted 5 lines
Quoted 5 lines
--- tools/perf/bench/synthesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
tools/perf/bench/synthesize.c static int do_run_multi_threaded(struct target *target, · line 166
Quoted 12 lines
tools/perf/bench/synthesize.c +2
-2@@ -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 '{'.
tools/perf/bench/synthesize.c +1
-1@@ -162,7 +162,7 @@ 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 (IS_ERR (session)) { +if (IS_ERR (session))return PTR_ERR (session);atomic_set (&event_count,0 );.
Arnaldo Carvalho de Melo
maintainerEm Fri, Sep 04, 2020 at 09:25:02PM +0800, Yuehaibing escreveu:
Quoted 10 lines · Arnaldo Carvalho de Melo
Quoted 7 lines
Em Thu, Sep 03, 2020 at 03:54:51PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")Signed-off-by YueHaibing <[email protected]>Thanks, applied, kudos for adding the Fixes: tag, appreciated!
But...
OOps, sorry for this, I'll pay attention next time.
Thanks!
- Arnaldo
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Review static int do_run_multi_threaded(struct target *target, · line 166
Quoted 9 lines
+++
b/tools/perf/bench/synthesize.c(quoted diff) +2
-2@@ -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 '{'.