[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220618021517.4056054-1-windhl@126.com>
Date: Sat, 18 Jun 2022 10:15:17 +0800
From: Liang He <windhl@....com>
To: andrew@...n.ch, gregory.clement@...tlin.com,
sebastian.hesselbarth@...il.com, linux@...linux.org.uk
Cc: windhl@....com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] arm: mach-mvebu: Fix refcount leak bug in pm.c
In mvebu_internal_reg_base(), of_find_node_by_name() will return a
node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He <windhl@....com>
---
arch/arm/mach-mvebu/pm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
index c487be61d6d8..d00e43241dfa 100644
--- a/arch/arm/mach-mvebu/pm.c
+++ b/arch/arm/mach-mvebu/pm.c
@@ -91,6 +91,7 @@ static phys_addr_t mvebu_internal_reg_base(void)
{
struct device_node *np;
__be32 in_addr[2];
+ phys_addr_t addr;
np = of_find_node_by_name(NULL, "internal-regs");
BUG_ON(!np);
@@ -103,7 +104,11 @@ static phys_addr_t mvebu_internal_reg_base(void)
in_addr[0] = cpu_to_be32(0xf0010000);
in_addr[1] = 0x0;
- return of_translate_address(np, in_addr);
+ addr = of_translate_address(np, in_addr);
+
+ of_node_put(np);
+
+ return addr;
}
static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)
--
2.25.1
Powered by blists - more mailing lists