diff options
author | Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com> | 2022-11-20 14:26:18 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-21 03:17:46 +0300 |
commit | d2973ffd25c2295055349212ca26c18929e5e9f5 (patch) | |
tree | a2b3184fc9691be6d9b417165dfec0e60507b73b /tools/bpf/bpftool/struct_ops.c | |
parent | 989f285159b84831c54d277112dcf803da51e722 (diff) | |
download | linux-d2973ffd25c2295055349212ca26c18929e5e9f5.tar.xz |
bpftool: fix error message when function can't register struct_ops
It is expected that errno be passed to strerror(). This also cleans
this part of code from using libbpf_get_error().
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Acked-by: Yonghong Song <yhs@fb.com>
Suggested-by: Quentin Monnet <quentin@isovalent.com>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20221120112515.38165-4-sahid.ferdjaoui@industrialdiscipline.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/bpf/bpftool/struct_ops.c')
-rw-r--r-- | tools/bpf/bpftool/struct_ops.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c index d3cfdfef9b58..ae9ad85f5cda 100644 --- a/tools/bpf/bpftool/struct_ops.c +++ b/tools/bpf/bpftool/struct_ops.c @@ -511,10 +511,9 @@ static int do_register(int argc, char **argv) continue; link = bpf_map__attach_struct_ops(map); - if (libbpf_get_error(link)) { + if (!link) { p_err("can't register struct_ops %s: %s", - bpf_map__name(map), - strerror(-PTR_ERR(link))); + bpf_map__name(map), strerror(errno)); nr_errs++; continue; } |