Re: [PATCH] btf: Simplify BTF logic with use of __free(btf_put)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 1 Aug 2025 08:02:24 -0700
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:

> > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> > index 1d2cf898e21e..480657912c96 100644
> > --- a/kernel/bpf/btf.c
> > +++ b/kernel/bpf/btf.c
> > @@ -3788,7 +3788,7 @@ static int btf_parse_kptr(const struct btf *btf, struct btf_field *field,
> >         /* If a matching btf type is found in kernel or module BTFs, kptr_ref
> >          * is that BTF, otherwise it's program BTF
> >          */
> > -       struct btf *kptr_btf;
> > +       struct btf *kptr_btf __free(btf_put) = NULL;  
> 
> Sorry I hate this __free() style.
> It's not a simplification, but an obfuscation of code and logic.

Well, it's becoming more common. But you are in control of this, so it's
your decision. I wanted this just to get rid of the gotos in my code.

-- Steve




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux