From: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Perry Yuan <Perry.Yuan@amd.com>, Huang Rui <ray.huang@amd.com>,
Mario Limonciello <mario.limonciello@amd.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] cpufreq: amd-pstate: Fix uninitialized variable in amd_pstate_cpu_boost_update()
Date: Mon, 22 Jul 2024 14:25:52 +0530 [thread overview]
Message-ID: <Zp4emEks9X5jL1x7@BLRRASHENOY1.amd.com> (raw)
In-Reply-To: <7ff53543-6c04-48a0-8d99-7dc010b93b3a@stanley.mountain>
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@linaro.org>
Acked-by: Gautham R. Shenoy <gautham.shenoy@amd.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
>
prev parent reply other threads:[~2024-07-22 8:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 20:08 Dan Carpenter
2024-07-19 6:38 ` Yuan, Perry
2024-07-22 8:55 ` Gautham R. Shenoy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zp4emEks9X5jL1x7@BLRRASHENOY1.amd.com \
--to=gautham.shenoy@amd.com \
--cc=Perry.Yuan@amd.com \
--cc=dan.carpenter@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®