* [PATCH -next] perf bench: fix return value check in do_run_multi_threaded()
@ 2020-09-02 14:05 YueHaibing
2020-09-02 16:09 ` Ian Rogers
2020-09-03 18:53 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 7+ messages in thread
From: YueHaibing @ 2020-09-02 14:05 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, irogers
Cc: linux-kernel, YueHaibing
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>
---
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);
atomic_set(&event_count, 0);
gettimeofday(&start, NULL);
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() 2020-09-02 14:05 [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() YueHaibing @ 2020-09-02 16:09 ` Ian Rogers 2020-09-03 18:53 ` Arnaldo Carvalho de Melo 1 sibling, 0 replies; 7+ messages in thread From: Ian Rogers @ 2020-09-02 16:09 UTC (permalink / raw) To: YueHaibing Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, LKML On Wed, Sep 2, 2020 at 7:06 AM YueHaibing <yuehaibing@huawei.com> wrote: > > 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> Acked-by: Ian Rogers <irogers@google.com> Thanks! Ian > --- > 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); > > atomic_set(&event_count, 0); > gettimeofday(&start, NULL); > -- > 2.17.1 > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() 2020-09-02 14:05 [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() YueHaibing 2020-09-02 16:09 ` Ian Rogers @ 2020-09-03 18:53 ` Arnaldo Carvalho de Melo 2020-09-03 18:54 ` Arnaldo Carvalho de Melo 1 sibling, 1 reply; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2020-09-03 18:53 UTC (permalink / raw) To: YueHaibing Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung, irogers, linux-kernel 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! - Arnaldo > --- > 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); > > atomic_set(&event_count, 0); > gettimeofday(&start, NULL); > -- > 2.17.1 > > -- - Arnaldo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() 2020-09-03 18:53 ` Arnaldo Carvalho de Melo @ 2020-09-03 18:54 ` Arnaldo Carvalho de Melo 2020-09-03 18:55 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2020-09-03 18:54 UTC (permalink / raw) To: YueHaibing Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung, irogers, linux-kernel 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() 2020-09-03 18:54 ` Arnaldo Carvalho de Melo @ 2020-09-03 18:55 ` Arnaldo Carvalho de Melo 2020-09-04 13:25 ` Yuehaibing 0 siblings, 1 reply; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2020-09-03 18:55 UTC (permalink / raw) To: YueHaibing Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung, irogers, linux-kernel Em Thu, Sep 03, 2020 at 03:54:51PM -0300, Arnaldo Carvalho de Melo escreveu: > 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 '{'. diff --git a/tools/perf/bench/synthesize.c b/tools/perf/bench/synthesize.c index e39daa609db2ed9b..b2924e3181dc3844 100644 --- a/tools/perf/bench/synthesize.c +++ b/tools/perf/bench/synthesize.c @@ -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); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() 2020-09-03 18:55 ` Arnaldo Carvalho de Melo @ 2020-09-04 13:25 ` Yuehaibing 2020-09-04 16:22 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 7+ messages in thread From: Yuehaibing @ 2020-09-04 13:25 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung, irogers, linux-kernel On 2020/9/4 2:55, Arnaldo Carvalho de Melo wrote: > Em Thu, Sep 03, 2020 at 03:54:51PM -0300, Arnaldo Carvalho de Melo escreveu: >> 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... OOps, sorry for this, I'll pay attention next time. >> >>>> --- >>>> 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 '{'. > > diff --git a/tools/perf/bench/synthesize.c b/tools/perf/bench/synthesize.c > index e39daa609db2ed9b..b2924e3181dc3844 100644 > --- a/tools/perf/bench/synthesize.c > +++ b/tools/perf/bench/synthesize.c > @@ -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); > > . > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() 2020-09-04 13:25 ` Yuehaibing @ 2020-09-04 16:22 ` Arnaldo Carvalho de Melo 0 siblings, 0 replies; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2020-09-04 16:22 UTC (permalink / raw) To: Yuehaibing Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung, irogers, linux-kernel Em Fri, Sep 04, 2020 at 09:25:02PM +0800, Yuehaibing escreveu: > On 2020/9/4 2:55, Arnaldo Carvalho de Melo wrote: > > Em Thu, Sep 03, 2020 at 03:54:51PM -0300, Arnaldo Carvalho de Melo escreveu: > >>>> 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... > OOps, sorry for this, I'll pay attention next time. Thanks! - Arnaldo > >>>> +++ 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 '{'. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-04 16:22 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-09-02 14:05 [PATCH -next] perf bench: fix return value check in do_run_multi_threaded() YueHaibing 2020-09-02 16:09 ` Ian Rogers 2020-09-03 18:53 ` Arnaldo Carvalho de Melo 2020-09-03 18:54 ` Arnaldo Carvalho de Melo 2020-09-03 18:55 ` Arnaldo Carvalho de Melo 2020-09-04 13:25 ` Yuehaibing 2020-09-04 16:22 ` Arnaldo Carvalho de Melo
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.