[intel-tdx:kvm-upstream-workaround 292/361] arch/x86/virt/vmx/tdx/tdx_debug.c:38:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false

From: kernel test robot
Date: Fri May 06 2022 - 03:37:37 EST


tree: https://github.com/intel/tdx.git kvm-upstream-workaround
head: 3b5b338cdf10dca7a2435d1f86b2dd9f1a3ad833
commit: 35b7a73dd22642a50aa614a812f76289a59d1509 [292/361] [REVERTME] debugfs to operation on TDX debug op
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220506/202205061552.nQdkBaVb-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
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://github.com/intel/tdx/commit/35b7a73dd22642a50aa614a812f76289a59d1509
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm-upstream-workaround
git checkout 35b7a73dd22642a50aa614a812f76289a59d1509
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

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

All warnings (new ones prefixed by >>):

>> arch/x86/virt/vmx/tdx/tdx_debug.c:38:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (debugconfig_supported) {
^~~~~~~~~~~~~~~~~~~~~
arch/x86/virt/vmx/tdx/tdx_debug.c:46:10: note: uninitialized use occurs here
return ret;
^~~
arch/x86/virt/vmx/tdx/tdx_debug.c:38:2: note: remove the 'if' if its condition is always true
if (debugconfig_supported) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/virt/vmx/tdx/tdx_debug.c:36:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.


vim +38 arch/x86/virt/vmx/tdx/tdx_debug.c

32
33 static inline u64 tddebugconfig(u64 subleaf, u64 param1, u64 param2)
34 {
35 static bool debugconfig_supported = true;
36 int ret;
37
> 38 if (debugconfig_supported) {
39 ret = __seamcall(SEAMCALL_TDDEBUGCONFIG, subleaf, param1, param2, 0, NULL);
40 if (ret) {
41 pr_info("DEBUGCONFIG SEAMCALL isn't supported.\n");
42 debugconfig_supported = false;
43 }
44 }
45
46 return ret;
47 }
48

--
0-DAY CI Kernel Test Service
https://01.org/lkp