summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>2024-10-31 13:33:36 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-21 13:49:09 +0100
commit49ad06896c072bd0fb54cb5ac19095c830fb1b48 (patch)
treeccc7e01c9ac2f511e76f0d0253234e3cd2305017 /drivers/soc
parent208e102a2fca44e40a6c3f7b9e2609cfd17a15aa (diff)
downloadlinux-49ad06896c072bd0fb54cb5ac19095c830fb1b48.tar.gz
linux-49ad06896c072bd0fb54cb5ac19095c830fb1b48.tar.bz2
linux-49ad06896c072bd0fb54cb5ac19095c830fb1b48.zip
soc: atmel: fix device_node release in atmel_soc_device_init()
[ Upstream commit d3455ab798100f40af77123e7c2443ec979c546b ] 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. Instead of adding the missing calls to of_node_put() in all execution paths, use the cleanup attribute for 'np' by means of the __free() macro, which automatically calls of_node_put() when the variable goes out of scope. Fixes: 960ddf70cc11 ("drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://lore.kernel.org/r/20241031-soc-atmel-soc-cleanup-v2-1-73f2d235fd98@gmail.com Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/atmel/soc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
index dae8a2e0f745..78cb2c4bd392 100644
--- a/drivers/soc/atmel/soc.c
+++ b/drivers/soc/atmel/soc.c
@@ -367,7 +367,7 @@ static const struct of_device_id at91_soc_allowed_list[] __initconst = {
static int __init atmel_soc_device_init(void)
{
- struct device_node *np = of_find_node_by_path("/");
+ struct device_node *np __free(device_node) = of_find_node_by_path("/");
if (!of_match_node(at91_soc_allowed_list, np))
return 0;