On Sun, 13 Nov 2022 at 10:15, Sahid Orentino Ferdjaoui <sahid.ferdjaoui@xxxxxxxxxxxxxxxxxxxxxxxx> wrote: > > 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@xxxxxxxxxxxxxxxxxxxxxxxx> > Acked-by: Yonghong Song <yhs@xxxxxx> > --- > tools/bpf/bpftool/struct_ops.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c > index e08a6ff2866c..1a235d0c6742 100644 > --- a/tools/bpf/bpftool/struct_ops.c > +++ b/tools/bpf/bpftool/struct_ops.c > @@ -62,11 +62,8 @@ static __s32 get_map_info_type_id(void) > if (map_info_type_id) > return map_info_type_id; > > - kern_btf = get_btf_vmlinux(); This line was seemingly removed by mistake. > - 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); > -- > 2.34.1 > >