[morse:mpam/snapshot/v5.18 139/146] drivers/platform/mpam/mpam_resctrl.c:226:6: warning: variable 'partid' is used uninitialized whenever 'if' condition is false

kernel test robot
2022-06-20T00:54:18Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/snapshot/v5.18
head: bac90d25cbdee0fc233b9b1c47d5b6f44101a384
commit: fcd8f8da43dcd27b641fb9a297094ff95113a977 [139/146] arm_mpam: resctrl: Add iommu helpers to get/set the partid and pmg
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20220620/202206200833.sGQrZPBe-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project af6d2a0b6825e71965f3e2701a63c239fa0ad70f)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/commit/?id=fcd8f8da43dcd27b641fb9a297094ff95113a977
git remote add morse https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git
git fetch --no-tags morse mpam/snapshot/v5.18
git checkout fcd8f8da43dcd27b641fb9a297094ff95113a977
# 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=arm64 SHELL=/bin/bash drivers/perf/ drivers/platform/mpam/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/platform/mpam/mpam_resctrl.c:226:6: warning: variable 'partid' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (cdp_enabled)
^~~~~~~~~~~
drivers/platform/mpam/mpam_resctrl.c:229:42: note: uninitialized use occurs here
return ops->set_group_qos_params(group, partid, rmid);
^~~~~~
drivers/platform/mpam/mpam_resctrl.c:226:2: note: remove the 'if' if its condition is always true
if (cdp_enabled)
^~~~~~~~~~~~~~~~
drivers/platform/mpam/mpam_resctrl.c:219:12: note: initialize the variable 'partid' to silence this warning
u16 partid;
^
= 0
drivers/platform/mpam/mpam_resctrl.c:381:25: warning: variable 'dom' is uninitialized when used here [-Wuninitialized]
mpam_msmon_reset_mbwu(dom->comp, &cfg);
^~~
drivers/platform/mpam/mpam_resctrl.c:370:30: note: initialize the variable 'dom' to silence this warning
struct mpam_resctrl_dom *dom;
^
= NULL
2 warnings generated.

vim +226 drivers/platform/mpam/mpam_resctrl.c

215
216 int resctrl_arch_set_iommu_closid_rmid(struct iommu_group *group, u32 closid,
217 u32 rmid)
218 {
219 u16 partid;
220 const struct iommu_ops *ops;
221
222 ops = iommu_group_get_ops(group);
223 if (!ops || !ops->set_group_qos_params)
224 return -EOPNOTSUPP;
225
> 226 if (cdp_enabled)
227 partid = closid << 1;
228
229 return ops->set_group_qos_params(group, partid, rmid);
230 }
231

--
0-DAY CI Kernel Test Service