[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zp4emEks9X5jL1x7@BLRRASHENOY1.amd.com>
Date: Mon, 22 Jul 2024 14:25:52 +0530
From: "Gautham R. Shenoy" <gautham.shenoy@....com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Perry Yuan <Perry.Yuan@....com>, Huang Rui <ray.huang@....com>,
Mario Limonciello <mario.limonciello@....com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] cpufreq: amd-pstate: Fix uninitialized variable in
amd_pstate_cpu_boost_update()
Hello Dan,
On Thu, Jul 18, 2024 at 03:08:36PM -0500, Dan Carpenter wrote:
> Smatch complains that "ret" could be uninitialized:
>
> drivers/cpufreq/amd-pstate.c:734 amd_pstate_cpu_boost_update()
> error: uninitialized symbol 'ret'.
>
> This seems like it probably is a real issue. Initialize "ret" to zero to
> be safe.
Thanks for catching this. Yes, it is a real issue on MSR based
platforms when the amd-pstate driver is not in the passive mode.
>
> Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
Acked-by: Gautham R. Shenoy <gautham.shenoy@....com>
> ---
> drivers/cpufreq/amd-pstate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 68c616b572f2..358bd88cd0c5 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -692,7 +692,7 @@ static int amd_pstate_cpu_boost_update(struct cpufreq_policy *policy, bool on)
> struct amd_cpudata *cpudata = policy->driver_data;
> struct cppc_perf_ctrls perf_ctrls;
> u32 highest_perf, nominal_perf, nominal_freq, max_freq;
> - int ret;
> + int ret = 0;
>
> highest_perf = READ_ONCE(cpudata->highest_perf);
> nominal_perf = READ_ONCE(cpudata->nominal_perf);
> --
> 2.43.0
>
Powered by blists - more mailing lists