Skip to contentSkip to conversation

csky: Don't leak device tree node reference

PATCH New Yangtao Li 1 participant 1 message Dec 27, 2018 C-sky architecture

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH v2 1/1 csky: Don't leak device tree node reference

of_find_node_by_type() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. setup_smp() doesn't do that, so fix it by converting to for_each_of_cpu_node().

---
 arch/csky/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/csky/kernel/smp.c +1 -1
index 36ebaf9834e1..74d627300c55 100644
@@ -138,7 +138,7 @@ void __init setup_smp(void)
 	struct device_node *node = NULL;
 	int cpu;
 
-	while ((node = of_find_node_by_type(node, "cpu"))) {
+	for_each_of_cpu_node(node) {
 		if (!of_device_is_available(node))
 			continue;
 
Signature · 1 line
2.17.0