Skip to contentSkip to conversation

mips: pic32: pic32mzda: Add missing of_node_put() in init.c

PATCH New Liang He 1 participant 1 message Jun 15, 2022 MIPS

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 mips: pic32: pic32mzda: Add missing of_node_put() in init.c

In pic32_of_prepare_platform_data(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.

---
 arch/mips/pic32/pic32mzda/init.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/mips/pic32/pic32mzda/init.c +4 -0
index 129915616763..2b134d5d54e1 100644
@@ -99,9 +99,13 @@ static int __init pic32_of_prepare_platform_data(struct of_dev_auxdata *lookup)
 		if (np) {
 			lookup->name = (char *)np->name;
 			if (lookup->phys_addr)
+			{
+				of_node_put(np);
 				continue;
+			}
 			if (!of_address_to_resource(np, 0, &res))
 				lookup->phys_addr = res.start;
+			of_node_put(np);
 		}
 	}
 
Signature · 1 line
2.25.1