diff options
author | Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com> | 2022-11-20 14:26:07 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-21 03:17:46 +0300 |
commit | 989f285159b84831c54d277112dcf803da51e722 (patch) | |
tree | 25d2e9e8fd77eb7b79c2dbbfd10104be56512bbc /tools/bpf/bpftool/struct_ops.c | |
parent | 9b8107553424fd87955fed257a807672c2097297 (diff) | |
download | linux-989f285159b84831c54d277112dcf803da51e722.tar.xz |
bpftool: replace return value PTR_ERR(NULL) with 0
There is no reasons to keep PTR_ERR() when kern_btf=NULL, let's just
return 0.
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>
Link: https://lore.kernel.org/r/20221120112515.38165-3-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 | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c index e08a6ff2866c..d3cfdfef9b58 100644 --- a/tools/bpf/bpftool/struct_ops.c +++ b/tools/bpf/bpftool/struct_ops.c @@ -63,10 +63,8 @@ static __s32 get_map_info_type_id(void) return map_info_type_id; kern_btf = get_btf_vmlinux(); - if (libbpf_get_error(kern_btf)) { - map_info_type_id = PTR_ERR(kern_btf); - return map_info_type_id; - } + if (!kern_btf) + return 0; map_info_type_id = btf__find_by_name_kind(kern_btf, "bpf_map_info", BTF_KIND_STRUCT); |