public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: YueHaibing <yuehaibing@huawei.com>
Cc: peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@redhat.com,
	namhyung@kernel.org, irogers@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] perf bench: fix return value check in do_run_multi_threaded()
Date: Thu, 3 Sep 2020 15:53:01 -0300	[thread overview]
Message-ID: <20200903185301.GE3495158@kernel.org> (raw)
In-Reply-To: <20200902140526.26916-1-yuehaibing@huawei.com>

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

  parent reply	other threads:[~2020-09-03 18:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200903185301.GE3495158@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox