[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241030-soc-atmel-soc-cleanup-v1-1-32b9e0773b14@gmail.com>
Date: Wed, 30 Oct 2024 18:10:44 +0100
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Beznea <claudiu.beznea@...on.dev>,
Sudeep Holla <sudeep.holla@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Javier Carrasco <javier.carrasco.cruz@...il.com>, stable@...r.kernel.org
Subject: [PATCH 1/2] drivers: soc: atmel: fix device_node release in
atmel_soc_device_init()
A device_node acquired via of_find_node_by_path() requires explicit
calls to of_node_put() when it is no longer needed to avoid leaking the
resource.
Add the missing of_node_put() in the different execution paths.
Cc: stable@...r.kernel.org
Fixes: 960ddf70cc11 ("drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
drivers/soc/atmel/soc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
index 2a42b28931c9..64b1ad063073 100644
--- a/drivers/soc/atmel/soc.c
+++ b/drivers/soc/atmel/soc.c
@@ -401,10 +401,13 @@ static int __init atmel_soc_device_init(void)
{
struct device_node *np = of_find_node_by_path("/");
- if (!of_match_node(at91_soc_allowed_list, np))
+ if (!of_match_node(at91_soc_allowed_list, np)) {
+ of_node_put(np);
return 0;
+ }
at91_soc_init(socs);
+ of_node_put(np);
return 0;
}
--
2.43.0
Powered by blists - more mailing lists