[pdx86-platform-drivers-x86:review-hans 55/60] drivers/platform/x86/thinkpad_acpi.c:10363:13: warning: variable 'err' is used uninitialized whenever 'if' condition is false

From: kernel test robot
Date: Tue Mar 08 2022 - 14:35:50 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-hans
head: 3b27ba0ca419a059f5473ccb5e183a2c0c0a0771
commit: e1c21608e3cfc4b44ecdf04e12986b6564667095 [55/60] platform/x86: thinkpad_acpi: Add PSC mode support
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220309/202203090344.60tG1m9i-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d74a3a514cf64731ecd21e1453aa78af79a565f2)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?id=e1c21608e3cfc4b44ecdf04e12986b6564667095
git remote add pdx86-platform-drivers-x86 https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
git fetch --no-tags pdx86-platform-drivers-x86 review-hans
git checkout e1c21608e3cfc4b44ecdf04e12986b6564667095
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/platform/x86/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/platform/x86/thinkpad_acpi.c:10363:13: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (dytc_profile_available == DYTC_FUNCMODE_PSC)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/x86/thinkpad_acpi.c:10367:6: note: uninitialized use occurs here
if (err)
^~~
drivers/platform/x86/thinkpad_acpi.c:10363:9: note: remove the 'if' if its condition is always true
} else if (dytc_profile_available == DYTC_FUNCMODE_PSC)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/x86/thinkpad_acpi.c:10354:17: note: initialize the variable 'err' to silence this warning
int output, err;
^
= 0
1 warning generated.


vim +10363 drivers/platform/x86/thinkpad_acpi.c

10350
10351 static void dytc_profile_refresh(void)
10352 {
10353 enum platform_profile_option profile;
10354 int output, err;
10355 int perfmode;
10356
10357 mutex_lock(&dytc_mutex);
10358 if (dytc_profile_available == DYTC_FUNCMODE_MMC) {
10359 if (dytc_mmc_get_available)
10360 err = dytc_command(DYTC_CMD_MMC_GET, &output);
10361 else
10362 err = dytc_cql_command(DYTC_CMD_GET, &output);
10363 } else if (dytc_profile_available == DYTC_FUNCMODE_PSC)
10364 err = dytc_command(DYTC_CMD_GET, &output);
10365
10366 mutex_unlock(&dytc_mutex);
10367 if (err)
10368 return;
10369
10370 perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF;
10371 convert_dytc_to_profile(perfmode, &profile);
10372 if (profile != dytc_current_profile) {
10373 dytc_current_profile = profile;
10374 platform_profile_notify();
10375 }
10376 }
10377

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx