[bvanassche:ufs-for-next 16/17] drivers/scsi/ufs/ufshcd.c:1086:3: warning: variable 'pending' is uninitialized when used here

From: kernel test robot
Date: Thu Dec 02 2021 - 18:40:48 EST


tree: https://github.com/bvanassche/linux ufs-for-next
head: a4bec7f1327808f88f380bcfc67a0bf56ecc343f
commit: 07dc2a50633fbd851626e61b6b214890bd411050 [16/17] scsi: ufs: Optimize the command queueing code
config: hexagon-randconfig-r006-20211202 (https://download.01.org/0day-ci/archive/20211203/202112030740.2OWuHbfI-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b553297ef3ee4dc2119d5429adf3072e90fac38)
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/bvanassche/linux/commit/07dc2a50633fbd851626e61b6b214890bd411050
git remote add bvanassche https://github.com/bvanassche/linux
git fetch --no-tags bvanassche ufs-for-next
git checkout 07dc2a50633fbd851626e61b6b214890bd411050
# 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=hexagon SHELL=/bin/bash drivers/scsi/ufs/

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/scsi/ufs/ufshcd.c:1086:3: warning: variable 'pending' is uninitialized when used here [-Wuninitialized]
pending += sbitmap_weight(&sdev->budget_map);
^~~~~~~
drivers/scsi/ufs/ufshcd.c:1083:13: note: initialize the variable 'pending' to silence this warning
u32 pending;
^
= 0
1 warning generated.


vim +/pending +1086 drivers/scsi/ufs/ufshcd.c

1072
1073 /*
1074 * Determine the number of pending commands by counting the bits in the SCSI
1075 * device budget maps. This approach has been selected because a bit is set in
1076 * the budget map before scsi_host_queue_ready() checks the host_self_blocked
1077 * flag. The host_self_blocked flag can be modified by calling
1078 * scsi_block_requests() or scsi_unblock_requests().
1079 */
1080 static u32 ufshcd_pending_cmds(struct ufs_hba *hba)
1081 {
1082 struct scsi_device *sdev;
1083 u32 pending;
1084
1085 shost_for_each_device(sdev, hba->host)
> 1086 pending += sbitmap_weight(&sdev->budget_map);
1087
1088 return pending;
1089 }
1090

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