[PATCH -next] ARM: versatile: Add missing of_node_put in dcscb_init

Peng Wu posted 1 patch 4 years, 1 month ago
arch/arm/mach-versatile/dcscb.c | 1 +
1 file changed, 1 insertion(+)
[PATCH -next] ARM: versatile: Add missing of_node_put in dcscb_init
Posted by Peng Wu 4 years, 1 month ago
The device_node pointer is returned by of_find_compatible_node
with refcount incremented. We should use of_node_put() to avoid
the refcount leak.

Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 arch/arm/mach-versatile/dcscb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-versatile/dcscb.c b/arch/arm/mach-versatile/dcscb.c
index 866270e7f271..d8797350996d 100644
--- a/arch/arm/mach-versatile/dcscb.c
+++ b/arch/arm/mach-versatile/dcscb.c
@@ -144,6 +144,7 @@ static int __init dcscb_init(void)
 	if (!node)
 		return -ENODEV;
 	dcscb_base = of_iomap(node, 0);
+	of_node_put(node);
 	if (!dcscb_base)
 		return -EADDRNOTAVAIL;
 	cfg = readl_relaxed(dcscb_base + DCS_CFG_R);
-- 
2.17.1
Re: [PATCH -next] ARM: versatile: Add missing of_node_put in dcscb_init
Posted by Linus Walleij 4 years, 1 month ago
On Mon, Apr 25, 2022 at 10:18 AM Peng Wu <wupeng58@huawei.com> wrote:

> The device_node pointer is returned by of_find_compatible_node
> with refcount incremented. We should use of_node_put() to avoid
> the refcount leak.
>
> Signed-off-by: Peng Wu <wupeng58@huawei.com>

I applied this on linux-next. signed off and sent directly to
the SoC tree.

Yours,
Linus Walleij