Skip to content

Commit bb79370

Browse files
committed
cpufreq/amd-pstate: Avoid shadowing ret in amd_pstate_ut_check_driver()
JIRA: https://issues.redhat.com/browse/RHEL-104550 commit f6b1eeb Author: Nathan Chancellor <nathan@kernel.org> Date: Mon May 12 23:28:55 2025 +0200 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: d26d164 ("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> Signed-off-by: Steve Best <sbest@redhat.com>
1 parent 6553698 commit bb79370

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/cpufreq/amd-pstate-ut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int amd_pstate_ut_check_driver(u32 index)
246246
int ret;
247247

248248
for (mode1 = AMD_PSTATE_DISABLE; mode1 < AMD_PSTATE_MAX; mode1++) {
249-
int ret = amd_pstate_set_mode(mode1);
249+
ret = amd_pstate_set_mode(mode1);
250250
if (ret)
251251
return ret;
252252
for (mode2 = AMD_PSTATE_DISABLE; mode2 < AMD_PSTATE_MAX; mode2++) {

0 commit comments

Comments
 (0)