Skip to contentSkip to conversation

pinctrl: nomadik: Add missing of_node_put() in nmk_pinctrl_probe

PATCH In review Miaoqian Lin 2 participants 2 messages Mar 7, 2022 – Mar 15, 2022

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

PATCH 1/1 pinctrl: nomadik: Add missing of_node_put() in nmk_pinctrl_probe

This node pointer is returned by of_parse_phandle() with refcount incremented in this function. Calling of_node_put() to avoid the refcount leak.

Fixes 32e67eee670e ("pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree")
---
 drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/nomadik/pinctrl-nomadik.c +3 -1
index 39828e9c3120..4757bf964d3c 100644
@@ -1883,8 +1883,10 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
 	}
 
 	prcm_np = of_parse_phandle(np, "prcm", 0);
-	if (prcm_np)
+	if (prcm_np) {
 		npct->prcm_base = of_iomap(prcm_np, 0);
+		of_node_put(prcm_np);
+	}
 	if (!npct->prcm_base) {
 		if (version == PINCTRL_NMK_STN8815) {
 			dev_info(&pdev->dev,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Miaoqian Lin

This node pointer is returned by of_parse_phandle() with refcount incremented in this function. Calling of_node_put() to avoid the refcount leak.

Fixes 32e67eee670e ("pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree")

Patch applied.

Yours,
Linus Walleij