All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Clément Léger" <clement.leger@bootlin.com>
To: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] clk: add missing of_node_put() in "assigned-clocks" property parsing
Date: Mon, 20 Feb 2023 12:44:20 +0100	[thread overview]
Message-ID: <20230220124420.4150c767@fixe.home> (raw)
In-Reply-To: <20230131083227.10990-1-clement.leger@bootlin.com>

Le Tue, 31 Jan 2023 09:32:27 +0100,
Clément Léger <clement.leger@bootlin.com> a écrit :

Ping ?

> When returning from of_parse_phandle_with_args(), the np member of the
> of_phandle_args structure should be put after usage. Add missing
> of_node_put() calls in both __set_clk_parents() and __set_clk_rates().
> 
> Fixes: 86be408bfbd8 ("clk: Support for clock parents and rates assigned from device tree")
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> ---
> v2:
>  - Add "Fixes"
> 
>  drivers/clk/clk-conf.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c
> index 2ef819606c41..1a4e6340f95c 100644
> --- a/drivers/clk/clk-conf.c
> +++ b/drivers/clk/clk-conf.c
> @@ -33,9 +33,12 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
>  			else
>  				return rc;
>  		}
> -		if (clkspec.np == node && !clk_supplier)
> +		if (clkspec.np == node && !clk_supplier) {
> +			of_node_put(clkspec.np);
>  			return 0;
> +		}
>  		pclk = of_clk_get_from_provider(&clkspec);
> +		of_node_put(clkspec.np);
>  		if (IS_ERR(pclk)) {
>  			if (PTR_ERR(pclk) != -EPROBE_DEFER)
>  				pr_warn("clk: couldn't get parent clock %d for %pOF\n",
> @@ -48,10 +51,12 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
>  		if (rc < 0)
>  			goto err;
>  		if (clkspec.np == node && !clk_supplier) {
> +			of_node_put(clkspec.np);
>  			rc = 0;
>  			goto err;
>  		}
>  		clk = of_clk_get_from_provider(&clkspec);
> +		of_node_put(clkspec.np);
>  		if (IS_ERR(clk)) {
>  			if (PTR_ERR(clk) != -EPROBE_DEFER)
>  				pr_warn("clk: couldn't get assigned clock %d for %pOF\n",
> @@ -93,10 +98,13 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier)
>  				else
>  					return rc;
>  			}
> -			if (clkspec.np == node && !clk_supplier)
> +			if (clkspec.np == node && !clk_supplier) {
> +				of_node_put(clkspec.np);
>  				return 0;
> +			}
>  
>  			clk = of_clk_get_from_provider(&clkspec);
> +			of_node_put(clkspec.np);
>  			if (IS_ERR(clk)) {
>  				if (PTR_ERR(clk) != -EPROBE_DEFER)
>  					pr_warn("clk: couldn't get clock %d for %pOF\n",



-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

  reply	other threads:[~2023-02-20 11:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31  8:32 [PATCH v2] clk: add missing of_node_put() in "assigned-clocks" property parsing Clément Léger
2023-02-20 11:44 ` Clément Léger [this message]
2023-03-14 16:45   ` Clément Léger
2023-03-15  0:44 ` Stephen Boyd
2023-03-28  7:46   ` Clément Léger
2023-03-29 20:55 ` Stephen Boyd

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=20230220124420.4150c767@fixe.home \
    --to=clement.leger@bootlin.com \
    --cc=frowand.list@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.