[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWQ1-=a5pcYqkP7c_rQkKByfGkfXQ2O6pcAibeDjRVnDA@mail.gmail.com>
Date: Wed, 2 Sep 2020 09:09:31 -0700
From: Ian Rogers <irogers@...gle.com>
To: YueHaibing <yuehaibing@...wei.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded()
On Wed, Sep 2, 2020 at 7:06 AM YueHaibing <yuehaibing@...wei.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@...wei.com>
Acked-by: Ian Rogers <irogers@...gle.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
>
>
Powered by blists - more mailing lists