From: Jacky Bai <ping.bai@nxp.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
Zhang Rui <rui.zhang@intel.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
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>,
dl-linux-imx <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-pm@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/2] thermal: imx_sc: add missing of_node_put for loop iteration
Date: Tue, 27 Apr 2021 08:55:36 +0000 [thread overview]
Message-ID: <DBBPR04MB79307DF87746E3D5540910FD87419@DBBPR04MB7930.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20210425174831.164332-1-krzysztof.kozlowski@canonical.com>
> Subject: [PATCH 1/2] thermal: imx_sc: add missing of_node_put for loop
> iteration
>
> Early exits from for_each_available_child_of_node() should decrement the
> node reference counter. Reported by Coccinelle:
>
> drivers/thermal/imx_sc_thermal.c:93:1-33: WARNING:
> Function "for_each_available_child_of_node" should have of_node_put()
> before return around line 97.
>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
BR
Jacky Bai
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
> drivers/thermal/imx_sc_thermal.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/thermal/imx_sc_thermal.c
> b/drivers/thermal/imx_sc_thermal.c
> index b01d28eca7ee..8d76dbfde6a9 100644
> --- a/drivers/thermal/imx_sc_thermal.c
> +++ b/drivers/thermal/imx_sc_thermal.c
> @@ -93,6 +93,7 @@ static int imx_sc_thermal_probe(struct platform_device
> *pdev)
> for_each_available_child_of_node(np, child) {
> sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL);
> if (!sensor) {
> + of_node_put(child);
> of_node_put(sensor_np);
> return -ENOMEM;
> }
> @@ -104,6 +105,7 @@ static int imx_sc_thermal_probe(struct
> platform_device *pdev)
> dev_err(&pdev->dev,
> "failed to get valid sensor resource id: %d\n",
> ret);
> + of_node_put(child);
> break;
> }
>
> @@ -114,6 +116,7 @@ static int imx_sc_thermal_probe(struct
> platform_device *pdev)
> if (IS_ERR(sensor->tzd)) {
> dev_err(&pdev->dev, "failed to register thermal zone\n");
> ret = PTR_ERR(sensor->tzd);
> + of_node_put(child);
> break;
> }
>
> --
> 2.25.1
prev parent reply other threads:[~2021-04-27 8:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-25 17:48 Krzysztof Kozlowski
2021-04-25 17:48 ` [PATCH 2/2] thermal: sprd: " Krzysztof Kozlowski
2021-04-26 8:07 ` Chunyan Zhang
2021-04-27 8:55 ` Jacky Bai [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=DBBPR04MB79307DF87746E3D5540910FD87419@DBBPR04MB7930.eurprd04.prod.outlook.com \
--to=ping.bai@nxp.com \
--cc=amitk@kernel.org \
--cc=baolin.wang7@gmail.com \
--cc=daniel.lezcano@linaro.org \
--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
all inboxes | Powered by JetHome®