[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241030-cpuidle-riscv-sbi-cleanup-v1-1-5e08a22c9409@gmail.com>
Date: Wed, 30 Oct 2024 07:44:09 +0100
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Anup Patel <anup@...infault.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Atish Patra <atishp@...osinc.com>
Cc: Palmer Dabbelt <palmer@...osinc.com>, linux-pm@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
Javier Carrasco <javier.carrasco.cruz@...il.com>, stable@...r.kernel.org
Subject: [PATCH 1/2] cpuidle: riscv-sbi: fix device node release in early
exit of for_each_possible_cpu
The 'np' device_node is initialized via of_cpu_device_node_get(), which
requires explicit calls to of_node_put() when it is no longer required
to avoid leaking the resource.
Add the missing calls to of_node_put(np) in all execution paths.
Cc: stable@...r.kernel.org
Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
drivers/cpuidle/cpuidle-riscv-sbi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
index 14462c092039..2b3aec09b895 100644
--- a/drivers/cpuidle/cpuidle-riscv-sbi.c
+++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
@@ -513,11 +513,14 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
if (np &&
of_property_present(np, "power-domains") &&
of_property_present(np, "power-domain-names")) {
+ of_node_put(np);
continue;
} else {
sbi_cpuidle_use_osi = false;
+ of_node_put(np);
break;
}
+ of_node_put(np);
}
/* Populate generic power domains from DT nodes */
--
2.43.0
Powered by blists - more mailing lists