Linux-Amlogic Archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Marilene Andrade Garcia <marilene.agarcia@gmail.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	 Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	 Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	 Javier Carrasco <javier.carrasco.cruz@gmail.com>,
	 linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvmem: meson-efuse: Replacing the use of of_node_put to __free
Date: Wed, 15 May 2024 09:38:19 +0200 (CEST)	[thread overview]
Message-ID: <b628913c-559e-67ee-efe2-913992c98551@inria.fr> (raw)
In-Reply-To: <768c3e38-724a-42d7-a51d-16044bc69ed5@gmail.com>



On Tue, 14 May 2024, Marilene Andrade Garcia wrote:

> On 15/04/2024 22:17, MarileneGarcia wrote:
> > Use __free for device_node values, and thus drop calls to
> > of_node_put.
> >
> > The goal is to reduce memory management issues by using this
> > scope-based of_node_put() cleanup to simplify function exit
> > handling. When using __free a resource is allocated within a
> > block, it is automatically freed at the end of the block.
> >
> > Suggested-by: Julia Lawall <julia.lawall@inria.fr>
> > Signed-off-by: MarileneGarcia <marilene.agarcia@gmail.com>
> > ---
> >   drivers/nvmem/meson-efuse.c | 5 ++---
> >   1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c
> > index 33678d0af2c2..400a9a075e53 100644
> > --- a/drivers/nvmem/meson-efuse.c
> > +++ b/drivers/nvmem/meson-efuse.c
> > @@ -42,20 +42,19 @@ static int meson_efuse_probe(struct platform_device
> > *pdev)
> >   {
> >   	struct device *dev = &pdev->dev;
> >   	struct meson_sm_firmware *fw;
> > -	struct device_node *sm_np;
> >   	struct nvmem_device *nvmem;
> >   	struct nvmem_config *econfig;
> >   	struct clk *clk;
> >   	unsigned int size;
> > +	struct device_node *sm_np __free(device_node) =
> > +		of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0);
> >   -	sm_np = of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0);

There should be a blank line after the last variable declaration, so here.

julia

> >   	if (!sm_np) {
> >   		dev_err(&pdev->dev, "no secure-monitor node\n");
> >   		return -ENODEV;
> >   	}
> >     	fw = meson_sm_get(sm_np);
> > -	of_node_put(sm_np);
> >   	if (!fw)
> >   		return -EPROBE_DEFER;
> >
>
> Hello everyone,
> Did you have a chance to look at the patch? Any questions or suggestions about
> it?
>
> Thank you,
> Marilene
>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

      reply	other threads:[~2024-05-15  7:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  1:17 [PATCH] nvmem: meson-efuse: Replacing the use of of_node_put to __free MarileneGarcia
2024-05-15  2:29 ` Marilene Andrade Garcia
2024-05-15  7:38   ` Julia Lawall [this message]

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=b628913c-559e-67ee-efe2-913992c98551@inria.fr \
    --to=julia.lawall@inria.fr \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marilene.agarcia@gmail.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=skhan@linuxfoundation.org \
    --cc=srinivas.kandagatla@linaro.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).