From: Julia Lawall <julia.lawall@inria.fr>
To: Greg KH <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@google.com>,
devicetree@vger.kernel.org
Cc: Roman Storozhenko <romeusmeister@gmail.com>,
jirislaby@kernel.org, skhan@linuxfoundation.org,
javier.carrasco.cruz@gmail.com, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH] sysrq: Auto release device node using __free attribute
Date: Fri, 12 Apr 2024 08:21:30 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2404120807400.3229@hadrien> (raw)
In-Reply-To: <2024041211-statistic-reformist-bf70@gregkh>
[Adding the OF maintainers and device tree mailing list]
> > Maybe it would be nice to get rid of of_node_puts in the general case?
>
> That's a call for the of maintainer to make, and then if so, to do it
> across the whole tree, right?
Sure.
Rob and Saravana, what do you think about the following:
* Is it ok to use __free(device_tree) directly in a declaration, or is
there some macro that should be used instead?
* If is ok to use __free(device_tree) even in simple cases where a
variable is just declared at the start of the scope and freed at the end,
and there is no internediate error handling code?
Please see for example:
https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2401291455430.8649@hadrien/
But I don't think we can do the whole thing at once, in one patch. There
are a lot of things that need to be checked, and it don't break anything
to do them one at a time.
>
> > Even though this one is not very annoying, there are some other functions
> > where there are many of_node_puts, and convoluted error handling code to
> > incorporate them on both the success and failure path. So maybe it would
> > be better to avoid the situation of having them sometimes and not having
> > them other times? But this is an opinion, and if the general consensus is
> > to only get rid of the cases that currently add complexity, then that is
> > possible too.
>
> Let's keep things simple until it has to be complex please.
I meant that the current code is complex and error prone, and using __free
eliminates code that is ugly and has led to memory leaks in the past (and
a lot of effort to find and fix them in the past). Even if some instances
don't have that property, they may become more complex in the future, if
some error condition is detected.
julia
next prev parent reply other threads:[~2024-04-12 6:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 18:02 [PATCH] sysrq: Auto release device node using __free attribute Roman Storozhenko
2024-04-11 18:10 ` Greg KH
2024-04-11 18:25 ` Roman Storozhenko
2024-04-12 5:22 ` Greg KH
2024-04-11 18:11 ` Greg KH
2024-04-11 18:17 ` Julia Lawall
2024-04-12 5:22 ` Greg KH
2024-04-12 6:21 ` Julia Lawall [this message]
2024-04-13 19:15 ` Julia Lawall
2024-04-11 18:28 ` Roman Storozhenko
2024-04-12 5:20 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2404120807400.3229@hadrien \
--to=julia.lawall@inria.fr \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=robh@kernel.org \
--cc=romeusmeister@gmail.com \
--cc=saravanak@google.com \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox