Skip to contentSkip to conversation

ARM: mxs: Fix refcount leak in mxs_machine_init

PATCH New Miaoqian Lin 1 participant 1 message Jun 3, 2022

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

PATCH 1/1 ARM: mxs: Fix refcount leak in mxs_machine_init

of_find_node_by_path() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.

Fixes 2046338dcbc6 ("ARM: mxs: Use soc bus infrastructure")

---
changes in v2:
- update Fixes tag.
v1 Link: https://lore.kernel.org/r/[email protected]

---
 arch/arm/mach-mxs/mach-mxs.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-mxs/mach-mxs.c +1 -0
index 25c9d184fa4c..7d957cadd3e9 100644
@@ -393,6 +393,7 @@ static void __init mxs_machine_init(void)
 
 	root = of_find_node_by_path("/");
 	ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
+	of_node_put(root);
 	if (ret)
 		return;
 
Signature · 1 line
2.25.1