Skip to contentSkip to conversation

powerpc/mpc5xxx: Add missing fwnode_handle_put()

PATCH Applied Liang He 2 participants 2 messages Mar 22, 2023 – Aug 31, 2023 PowerPC

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 powerpc/mpc5xxx: Add missing fwnode_handle_put()

In mpc5xxx_fwnode_get_bus_frequency(), we should add fwnode_handle_put() when break out of the iteration fwnode_for_each_parent_node() as it will automatically increase and decrease the refcounter.

Fixes de06fba62af6 ("powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode")
---
 arch/powerpc/sysdev/mpc5xxx_clocks.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/sysdev/mpc5xxx_clocks.c +3 -1
index c5bf7e1b3780..58cee28e2399 100644
@@ -25,8 +25,10 @@ unsigned long mpc5xxx_fwnode_get_bus_frequency(struct fwnode_handle *fwnode)
 
 	fwnode_for_each_parent_node(fwnode, parent) {
 		ret = fwnode_property_read_u32(parent, "bus-frequency", &bus_freq);
-		if (!ret)
+		if (!ret) {
+			fwnode_handle_put(parent);
 			return bus_freq;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.25.1