On Tue, Nov 8, 2022 at 11:45 PM Sahid Orentino Ferdjaoui <sahid.ferdjaoui@xxxxxxxxxxxxxxxxxxxxxxxx> wrote: > > There is no reasons to keep PTR_ERR() when kern_btf=NULL, let's just > return 0. > > Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@xxxxxxxxxxxxxxxxxxxxxxxx> > --- > tools/bpf/bpftool/struct_ops.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c > index e08a6ff2866c..68281f9b7a0e 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 (libbpf_get_error(kern_btf)) > + return 0; > 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 > >