[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YLA+rfZ4Jb3oBFun@kernel.org>
Date: Thu, 27 May 2021 21:51:57 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>,
Ian Rogers <irogers@...gle.com>,
Song Liu <songliubraving@...com>
Subject: Re: [PATCH] perf stat: Fix error check for bpf_program__attach
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@...com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.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
Powered by blists - more mailing lists