* [PATCH v2] pinctrl: imx1-core: fix device_node refcount leak
@ 2026-08-14 19:05 manushprajwal
0 siblings, 0 replies; only message in thread
From: manushprajwal @ 2026-08-14 19:05 UTC (permalink / raw)
To: Frank Li
Cc: Dong Aisheng, Fabio Estevam, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, Linus Walleij, linux-gpio, imx, linux-arm-kernel,
Manush Prajwal
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>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-14 19:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 19:05 [PATCH v2] pinctrl: imx1-core: fix device_node refcount leak manushprajwal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox