[PATCH] powerpc/mpc5xxx: Add missing fwnode_handle_put()

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE1103d

2 messages, 2 authors, 2023-08-31 · open the first message on its own page

[PATCH] powerpc/mpc5xxx: Add missing fwnode_handle_put()

From: Liang He <hidden>
Date: 2023-03-22 03:36:33

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")
Signed-off-by: Liang He <redacted>
---
 arch/powerpc/sysdev/mpc5xxx_clocks.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/mpc5xxx_clocks.c b/arch/powerpc/sysdev/mpc5xxx_clocks.c
index c5bf7e1b3780..58cee28e2399 100644
--- a/arch/powerpc/sysdev/mpc5xxx_clocks.c
+++ b/arch/powerpc/sysdev/mpc5xxx_clocks.c
@@ -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;
-- 
2.25.1

Re: [PATCH] powerpc/mpc5xxx: Add missing fwnode_handle_put()

From: Michael Ellerman <hidden>
Date: 2023-08-31 04:11:28

On Wed, 22 Mar 2023 11:04:23 +0800, Liang He wrote:
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.
Applied to powerpc/next.

[1/1] powerpc/mpc5xxx: Add missing fwnode_handle_put()
      https://git.kernel.org/powerpc/c/b9bbbf4979073d5536b7650decd37fcb901e6556

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help