ARM: highbank: Fix OF node refcount leaks
PATCH 1/1 ARM: highbank: Fix OF node refcount leaks
highbank_init_irq() checks for a Cortex-A9 node with of_find_compatible_node(), but uses the returned node only as a boolean and drops the pointer without releasing the reference.
highbank_init() has the same issue for the Calxeda system registers node after mapping it with of_iomap(). of_iomap() does not consume the device node reference.
Release both node references after the corresponding use.
Fixes 7a2848d369b2 ("ARM: highbank: abstract out SCU usage")
Fixes 26cae166cff9 ("ARM: highbank: remove custom .init_time hook")
Signed-off-by Yuho Choi <[email protected]>
--- arch/arm/mach-highbank/highbank.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/mach-highbank/highbank.c +7 -1
@@ -50,10 +50,15 @@ static void highbank_l2c310_write_sec(unsigned long val, unsigned reg)static void __init highbank_init_irq (void ) { +struct device_node *np; +irqchip_init (); -if (of_find_compatible_node (NULL ,NULL ,"arm,cortex-a9" )) + np =of_find_compatible_node (NULL ,NULL ,"arm,cortex-a9" ); +if (np) { +of_node_put (np);highbank_scu_map_io (); + } }static void highbank_power_off (void )
@@ -141,6 +146,7 @@ static void __init highbank_init(void)/* Map system registers */ np =of_find_compatible_node (NULL ,NULL ,"calxeda,hb-sregs" ); sregs_base =of_iomap (np,0 ); +of_node_put (np);WARN_ON (!sregs_base);register_platform_power_off (highbank_power_off);
Signature · 1 line
2.43.0
Hi,
Just a gentle ping on this patch.
I would appreciate any feedback when you have a chance to review this.
Thanks