[mkp:5.18/discovery2 64/67] drivers/scsi/sd.c:1093:25: warning: suggest explicit braces to avoid ambiguous 'else'

kernel test robot
2022-02-12T10:41:35Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/linux.git 5.18/discovery2
head: 7c371ec158614870d9c9c5d1a9e0f0c35f9198d7
commit: 56db0eb9f48930efde746c3cb9af11524102dc76 [64/67] scsi: sd: Implement support for NDOB flag in WRITE SAME(16)
config: arc-axs103_smp_defconfig (https://download.01.org/0day-ci/archive/20220212/202202121644.TOit65Ia-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0
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/mkp/linux.git/commit/?id=56db0eb9f48930efde746c3cb9af11524102dc76
git remote add mkp https://git.kernel.org/pub/scm/linux/kernel/git/mkp/linux.git
git fetch --no-tags mkp 5.18/discovery2
git checkout 56db0eb9f48930efde746c3cb9af11524102dc76
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/scsi/

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

All warnings (new ones prefixed by >>):

drivers/scsi/sd.c: In function 'sd_config_write_zeroes':
>> drivers/scsi/sd.c:1093:25: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
1093 | else if (sdkp->max_ws_blocks)
| ^

vim +/else +1093 drivers/scsi/sd.c

e339c1a7c09ef73 Martin K. Petersen 2009-11-26 1076
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1077 static void sd_config_write_zeroes(struct scsi_disk *sdkp,
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1078 enum sd_zeroing_mode mode)
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1079 {
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1080 struct request_queue *q = sdkp->disk->queue;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1081 unsigned int logical_block_size = sdkp->device->sector_size;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1082
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1083 if (mode == SD_ZERO_DEFAULT && !sdkp->zeroing_override) {
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1084 mode = SD_ZERO_WRITE;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1085
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1086 if (sdkp->lbprz && sdkp->lbpws)
56db0eb9f48930e Martin K. Petersen 2019-02-27 1087 if (sdkp->ndob)
56db0eb9f48930e Martin K. Petersen 2019-02-27 1088 mode = SD_ZERO_WS16_NDOB;
56db0eb9f48930e Martin K. Petersen 2019-02-27 1089 else
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1090 mode = SD_ZERO_WS16_UNMAP;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1091 else if (sdkp->lbprz && sdkp->lbpws10)
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1092 mode = SD_ZERO_WS10_UNMAP;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 @1093 else if (sdkp->max_ws_blocks)
56db0eb9f48930e Martin K. Petersen 2019-02-27 1094 if (sdkp->ndob)
56db0eb9f48930e Martin K. Petersen 2019-02-27 1095 mode = SD_ZERO_WS16_NDOB;
56db0eb9f48930e Martin K. Petersen 2019-02-27 1096 else
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1097 mode = SD_ZERO_WS;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1098 }
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1099
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1100 if (mode == SD_ZERO_DISABLE)
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1101 sdkp->zeroing_override = true;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1102
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1103 sdkp->zeroing_mode = mode;
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1104 blk_queue_max_write_zeroes_sectors(q, sdkp->max_ws_blocks *
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1105 (logical_block_size >> 9));
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1106 }
e65ad69ab003e66 Martin K. Petersen 2022-01-03 1107

:::::: The code at line 1093 was first introduced by commit
:::::: e65ad69ab003e66d2055130bfc4c17e2d92cb7c3 scsi: sd: Move WRITE_ZEROES configuration to a separate function

:::::: TO: Martin K. Petersen <martin.petersen@oracle.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

---
0-DAY CI Kernel Test Service, Intel Corporation