linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	Zhang Rui <rui.zhang@intel.com>, Amit Kucheria <amitk@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang7@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH 2/2] thermal: sprd: add missing of_node_put for loop iteration
Date: Mon, 14 Jun 2021 19:28:53 +0200	[thread overview]
Message-ID: <9d4b9827-74fb-43ea-bcc0-5c780296e6c0@linaro.org> (raw)
In-Reply-To: <20210528115036.18222-2-krzysztof.kozlowski@canonical.com>

On 28/05/2021 13:50, Krzysztof Kozlowski wrote:
> Early exits from for_each_available_child_of_node() should decrement the
> node reference counter.  Reported by Coccinelle:
> 
>   drivers/thermal/sprd_thermal.c:387:1-23: WARNING:
>     Function "for_each_child_of_node" should have of_node_put() before goto around lines 391.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>
> ---
>  drivers/thermal/sprd_thermal.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
> index 3682edb2f466..2778971aaf03 100644
> --- a/drivers/thermal/sprd_thermal.c
> +++ b/drivers/thermal/sprd_thermal.c
> @@ -388,6 +388,7 @@ static int sprd_thm_probe(struct platform_device *pdev)
>  		sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL);
>  		if (!sen) {
>  			ret = -ENOMEM;
> +			of_node_put(sen_child);

Why not a new label for the rollback routine?

eg. goto out_of_node_put;

Or a new function devm_for_each_available_child_of_node() ?

>  			goto disable_clk;
>  		}
>  
> @@ -397,12 +398,14 @@ static int sprd_thm_probe(struct platform_device *pdev)
>  		ret = of_property_read_u32(sen_child, "reg", &sen->id);
>  		if (ret) {
>  			dev_err(&pdev->dev, "get sensor reg failed");
> +			of_node_put(sen_child);
>  			goto disable_clk;
>  		}
>  
>  		ret = sprd_thm_sensor_calibration(sen_child, thm, sen);
>  		if (ret) {
>  			dev_err(&pdev->dev, "efuse cal analysis failed");
> +			of_node_put(sen_child);
>  			goto disable_clk;
>  		}
>  
> @@ -416,6 +419,7 @@ static int sprd_thm_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "register thermal zone failed %d\n",
>  				sen->id);
>  			ret = PTR_ERR(sen->tzd);
> +			of_node_put(sen_child);
>  			goto disable_clk;
>  		}
>  
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2021-06-14 17:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 11:50 [RESEND PATCH 1/2] thermal: imx_sc: add missing of_node_put for loop iteration Krzysztof Kozlowski
2021-05-28 11:50 ` [RESEND PATCH 2/2] thermal: sprd: " Krzysztof Kozlowski
2021-06-14 17:28   ` Daniel Lezcano [this message]
2021-06-14 19:16     ` Krzysztof Kozlowski

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=9d4b9827-74fb-43ea-bcc0-5c780296e6c0@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=baolin.wang7@gmail.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=zhang.lyra@gmail.com \
    /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 NNTP newsgroup(s).