[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jAJN0dAHyUcpD1QvqZO36OmpGS2HpoRNkgG_-vNhO6tw@mail.gmail.com>
Date: Tue, 27 May 2025 15:27:50 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Sudeep Holla <sudeep.holla@....com>, Lorenzo Pieralisi <lpieralisi@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH next] cpuidle: psci: Fix uninitialized variable in dt_idle_state_present()
On Tue, May 27, 2025 at 7:45 AM Dan Carpenter <dan.carpenter@...aro.org> wrote:
>
> If the first cpu_node = of_cpu_device_node_get() fails then the cleanup.h
> code will try to free "state_node" but it hasn't been initialized yet.
> Declare the device_nodes where they are initialized to fix this.
>
> Fixes: 5836ebeb4a2b ("cpuidle: psci: Avoid initializing faux device if no DT idle states are present")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
> drivers/cpuidle/cpuidle-psci.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index 3c2756a539c4..4e1ba35deda9 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
> @@ -456,14 +456,13 @@ static struct faux_device_ops psci_cpuidle_ops = {
>
> static bool __init dt_idle_state_present(void)
> {
> - struct device_node *cpu_node __free(device_node);
> - struct device_node *state_node __free(device_node);
> -
> - cpu_node = of_cpu_device_node_get(cpumask_first(cpu_possible_mask));
> + struct device_node *cpu_node __free(device_node) =
> + of_cpu_device_node_get(cpumask_first(cpu_possible_mask));
> if (!cpu_node)
> return false;
>
> - state_node = of_get_cpu_state_node(cpu_node, 0);
> + struct device_node *state_node __free(device_node) =
> + of_get_cpu_state_node(cpu_node, 0);
> if (!state_node)
> return false;
>
> --
Applied, thanks!
Powered by blists - more mailing lists