From: Frank Li <Frank.li@oss.nxp.com>
To: manushprajwal <manushprajwal555@gmail.com>
Cc: Frank Li <Frank.Li@nxp.com>, Dong Aisheng <aisheng.dong@nxp.com>,
Fabio Estevam <festevam@gmail.com>, Jacky Bai <ping.bai@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Sascha Hauer <s.hauer@pengutronix.de>,
Linus Walleij <linusw@kernel.org>,
linux-gpio@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] pinctrl: imx1-core: fix device_node refcount leak
Date: Fri, 14 Aug 2026 16:50:13 -0400 [thread overview]
Message-ID: <an9_haXPyNHTPbDU@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260814190527.969-1-manushprajwal555@gmail.com>
On Sat, Aug 15, 2026 at 12:35:27AM +0530, manushprajwal wrote:
> From: Manush Prajwal <manushprajwal555@gmail.com>
>
> imx1_pinctrl_dt_is_flat_functions() iterated child and grandchild
> device nodes with for_each_child_of_node() but returned early from
> inside both loops without dropping the reference the iterator held on
> the current node.
>
> Rework both loops around for_each_child_of_node_scoped() instead of
> adding manual of_node_put() calls, matching the sibling helper in
> pinctrl-imx.c and imx1_pinctrl_parse_dt() in this same file, which
> already use the scoped variant.
>
> Signed-off-by: Manush Prajwal <manushprajwal555@gmail.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> v2: Use for_each_child_of_node_scoped() instead of manual of_node_put()
> calls, per Frank Li's review.
>
> drivers/pinctrl/freescale/pinctrl-imx1-core.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
> index b7bd4ef9c0..fa8f6a7e03 100644
> --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c
> +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
> @@ -547,14 +547,11 @@
> */
> static bool imx1_pinctrl_dt_is_flat_functions(struct device_node *np)
> {
> - struct device_node *function_np;
> - struct device_node *pinctrl_np;
> -
> - for_each_child_of_node(np, function_np) {
> + for_each_child_of_node_scoped(np, function_np) {
> if (of_property_present(function_np, "fsl,pins"))
> return true;
>
> - for_each_child_of_node(function_np, pinctrl_np) {
> + for_each_child_of_node_scoped(function_np, pinctrl_np) {
> if (of_property_present(pinctrl_np, "fsl,pins"))
> return false;
> }
> --
> 2.46.2.windows.1
prev parent reply other threads:[~2026-08-14 20:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 19:05 [PATCH v2] pinctrl: imx1-core: fix device_node refcount leak manushprajwal
2026-08-14 20:50 ` Frank Li [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=an9_haXPyNHTPbDU@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=manushprajwal555@gmail.com \
--cc=ping.bai@nxp.com \
--cc=s.hauer@pengutronix.de \
/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