Commit c673b7f5 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf stat: Fix error check for bpf_program__attach

It seems the bpf_program__attach() returns a negative error code instead
of a NULL pointer in case of error.

Fixes: 7fac83aa

 ("perf stat: Introduce 'bperf' to share hardware PMCs with BPF")
Signed-off-by: default avatarNamhyung Kim <>
Cc: Alexander Shishkin <>
Cc: Andi Kleen <>
Cc: Ian Rogers <>
Cc: Jiri Olsa <>
Cc: Mark Rutland <>
Cc: Peter Zijlstra <>
Cc: Song Liu <>

Signed-off-by: default avatarArnaldo Carvalho de Melo <>
parent c59870e2
......@@ -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;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment