Skip to contentSkip to conversation

soc: imx: gpc: fix reference count leak in imx_gpc_remove

PATCH In review Miaoqian Lin 2 participants 2 messages Oct 28, 2025 – Nov 4, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: imx: gpc: fix reference count leak in imx_gpc_remove

of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.

Fixes 721cabf6c660 ("soc: imx: move PGC handling to a new GPC driver")
---
 drivers/pmdomain/imx/gpc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pmdomain/imx/gpc.c +2 -0
index 33991f3c6b55..a34b260274f7 100644
@@ -536,6 +536,8 @@ static void imx_gpc_remove(struct platform_device *pdev)
 			return;
 		}
 	}
+
+	of_node_put(pgc_node);
 }
 
 static struct platform_driver imx_gpc_driver = {
Signature · 1 line
2.39.5 (Apple Git-154)
#1 lore raw
Quoted 8 lines · Miaoqian Lin

of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.

Fixes 721cabf6c660 ("soc: imx: move PGC handling to a new GPC driver")

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 20 lines
---
 drivers/pmdomain/imx/gpc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pmdomain/imx/gpc.c +2 -1
index 33991f3c6b55..a34b260274f7 100644
@@ -536,6 +536,8 @@ static void imx_gpc_remove(struct platform_device *pdev)
                        return;
                }
        }
+
+       of_node_put(pgc_node);
 }
 
 static struct platform_driver imx_gpc_driver = {
--

2.39.5 (Apple Git-154)