From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
Song Liu <songliubraving@fb.com>
Subject: Re: [PATCH] perf stat: Fix error check for bpf_program__attach
Date: Thu, 27 May 2021 21:51:57 -0300 [thread overview]
Message-ID: <YLA+rfZ4Jb3oBFun@kernel.org> (raw)
In-Reply-To: <20210527220052.1657578-1-namhyung@kernel.org>
Em Thu, May 27, 2021 at 03:00:52PM -0700, Namhyung Kim escreveu:
> It seems the bpf_program__attach() returns a negative error code
> instead of a NULL pointer in case of error.
Thanks, applied.
- Arnaldo
> Fixes: 7fac83aaf2ee ("perf stat: Introduce 'bperf' to share hardware PMCs with BPF")
> Cc: Song Liu <songliubraving@fb.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/bpf_counter.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
> index ddb52f748c8e..974f10e356f0 100644
> --- a/tools/perf/util/bpf_counter.c
> +++ b/tools/perf/util/bpf_counter.c
> @@ -451,10 +451,10 @@ static int bperf_reload_leader_program(struct evsel *evsel, int attr_map_fd,
> goto out;
> }
>
> - err = -1;
> link = bpf_program__attach(skel->progs.on_switch);
> - if (!link) {
> + if (IS_ERR(link)) {
> pr_err("Failed to attach leader program\n");
> + err = PTR_ERR(link);
> goto out;
> }
>
> --
> 2.32.0.rc0.204.g9fa02ecfa5-goog
>
--
- Arnaldo
prev parent reply other threads:[~2021-05-28 0:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 22:00 [PATCH] perf stat: Fix error check for bpf_program__attach Namhyung Kim
2021-05-28 0:51 ` Arnaldo Carvalho de Melo [this message]
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=YLA+rfZ4Jb3oBFun@kernel.org \
--to=acme@kernel.org \
--cc=ak@linux.intel.com \
--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@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.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