[hare-scsi-devel:eh-rework.v2 6/51] drivers/scsi/qla1280.c:1024:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is false

From: kernel test robot
Date: Tue Aug 17 2021 - 15:25:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git eh-rework.v2
head: 7603e2e1f37e470064b8c865b5d6470137baa79b
commit: 88c5b1c5ddc2129c875bb310a20ed02e5e24e7fd [6/51] qla1280: separate out host reset function from qla1280_error_action()
config: x86_64-randconfig-a015-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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/hare/scsi-devel.git/commit/?id=88c5b1c5ddc2129c875bb310a20ed02e5e24e7fd
git remote add hare-scsi-devel https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
git fetch --no-tags hare-scsi-devel eh-rework.v2
git checkout 88c5b1c5ddc2129c875bb310a20ed02e5e24e7fd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

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/qla1280.c:1024:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (qla1280_abort_isp(ha) != 0) { /* it's dead */
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla1280.c:1032:9: note: uninitialized use occurs here
return rc;
^~
drivers/scsi/qla1280.c:1024:2: note: remove the 'if' if its condition is always true
if (qla1280_abort_isp(ha) != 0) { /* it's dead */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla1280.c:1010:8: note: initialize the variable 'rc' to silence this warning
int rc;
^
= 0
1 warning generated.


vim +1024 drivers/scsi/qla1280.c

1002
1003 /**************************************************************************
1004 * qla1280_adapter_reset
1005 * Reset the specified adapter (both channels)
1006 **************************************************************************/
1007 static int
1008 qla1280_eh_adapter_reset(struct scsi_cmnd *cmd)
1009 {
1010 int rc;
1011 struct Scsi_Host *shost = cmd->device->host;
1012 struct scsi_qla_host *ha = (struct scsi_qla_host *)shost->hostdata;
1013
1014 spin_lock_irq(shost->host_lock);
1015 if (qla1280_verbose) {
1016 printk(KERN_INFO
1017 "scsi(%ld): Issued ADAPTER RESET\n",
1018 ha->host_no);
1019 printk(KERN_INFO "scsi(%ld): I/O processing will "
1020 "continue automatically\n", ha->host_no);
1021 }
1022 ha->flags.reset_active = 1;
1023
> 1024 if (qla1280_abort_isp(ha) != 0) { /* it's dead */
1025 rc = FAILED;
1026 }
1027
1028 ha->flags.reset_active = 0;
1029
1030 spin_unlock_irq(shost->host_lock);
1031
1032 return rc;
1033 }
1034

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

Attachment: .config.gz
Description: application/gzip