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 Mon, 4 Aug 2025 22:26:45 +0900
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:

> On Fri, 1 Aug 2025 07:16:22 -0400
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> 
> > From: Steven Rostedt <rostedt@xxxxxxxxxxx>
> > 
> > Several functions need to call btf_put() on the btf pointer before it
> > returns leading to using "goto" branches to jump to the end to call
> > btf_put(btf). This can be simplified by introducing DEFINE_FREE() to allow
> > functions to define the btf descriptor with:
> > 
> >    struct btf *btf __free(btf_put) = NULL;
> > 
> > Then the btf descriptor will always have btf_put() called on it if it
> > isn't NULL or ERR before exiting the function.
> > 
> > Where needed, no_free_ptr(btf) is used to assign the btf descriptor to a
> > pointer that will be used outside the function.
> >   
> 
> Yeah, this looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>

Thanks but Alexei already declined it.

I'm gonna respin where it is only used in the tracing code.

Thanks!

-- 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