Skip to contentSkip to conversation

drivers: clk: Add missing of_node_put() in clk-nomadik.c

PATCH Superseded heliang 2 participants 2 messages Jun 15, 2022 – Jun 25, 2022

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

heliang

author
#0 lore raw

PATCH 1/1 drivers: clk: Add missing of_node_put() in clk-nomadik.c

In nomadik_src_init, of_find_matching_node() return a node pointer with refcount incremented. We should use of_node_put() in fail path or when it is not used anymore.

---
 drivers/clk/clk-nomadik.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/clk-nomadik.c +2 -0
index bad2677e11ae..b3b8855d8890 100644
@@ -97,6 +97,7 @@ static void __init nomadik_src_init(void)
 	}
 	src_base = of_iomap(np, 0);
 	if (!src_base) {
+		of_node_put(np);
 		pr_err("%s: must have src parent node with REGS (%pOFn)\n",
 		       __func__, np);
 		return;
@@ -130,6 +131,7 @@ static void __init nomadik_src_init(void)
 		val &= ~SRC_XTALCR_MXTALEN;
 		pr_info("disabling MXTALO\n");
 	}
+	of_node_put(np);
 	writel(val, src_base + SRC_XTALCR);
 	register_reboot_notifier(&nomadik_clk_reboot_notifier);
 }
Signature · 1 line
2.25.1