aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2025-05-12 23:28:55 +0200
committerMario Limonciello <mario.limonciello@amd.com>2025-05-13 11:12:44 -0500
commitf6b1eebbdbc75377f98fc9774bb86ffc270dae8e (patch)
treebf6d164034f96bab373e24dc07845a1f5395b5e7 /drivers/cpufreq
parentamd-pstate-ut: Reset amd-pstate driver mode after running selftests (diff)
downloadlinux-rng-f6b1eebbdbc75377f98fc9774bb86ffc270dae8e.tar.xz
linux-rng-f6b1eebbdbc75377f98fc9774bb86ffc270dae8e.zip
cpufreq/amd-pstate: Avoid shadowing ret in amd_pstate_ut_check_driver()
Clang warns (or errors with CONFIG_WERROR=y): drivers/cpufreq/amd-pstate-ut.c:262:6: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized] 262 | if (ret) | ^~~ ret is declared at the top of the function and in the for loop so the initialization of ret is local to the loop. Remove the declaration in the for loop so that ret is always used initialized. Fixes: d26d16438bc5 ("amd-pstate-ut: Reset amd-pstate driver mode after running selftests") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202505072226.g2QclhaR-lkp@intel.com/ Signed-off-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20250512-amd-pstate-ut-uninit-ret-v1-1-fcb4104f502e@kernel.org Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/amd-pstate-ut.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
index 30835d0e4994..65f9d2bae2d3 100644
--- a/drivers/cpufreq/amd-pstate-ut.c
+++ b/drivers/cpufreq/amd-pstate-ut.c
@@ -246,7 +246,7 @@ static int amd_pstate_ut_check_driver(u32 index)
int ret;
for (mode1 = AMD_PSTATE_DISABLE; mode1 < AMD_PSTATE_MAX; mode1++) {
- int ret = amd_pstate_set_mode(mode1);
+ ret = amd_pstate_set_mode(mode1);
if (ret)
return ret;
for (mode2 = AMD_PSTATE_DISABLE; mode2 < AMD_PSTATE_MAX; mode2++) {