[linux-next:master 2829/11867] drivers/scsi/scsi.c:591:1-3: WARNING: possible condition with no effect (if == else) (fwd)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




---------- Forwarded message ----------
Date: Thu, 22 Jun 2023 16:48:03 +0800
From: kernel test robot <lkp@xxxxxxxxx>
To: oe-kbuild@xxxxxxxxxxxxxxx
Cc: lkp@xxxxxxxxx, Julia Lawall <julia.lawall@xxxxxxxx>
Subject: [linux-next:master 2829/11867] drivers/scsi/scsi.c:591:1-3: WARNING:
    possible condition with no effect (if == else)

BCC: lkp@xxxxxxxxx
CC: oe-kbuild-all@xxxxxxxxxxxxxxx
CC: Linux Memory Management List <linux-mm@xxxxxxxxx>
TO: Damien Le Moal <dlemoal@xxxxxxxxxx>
CC: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>
CC: Hannes Reinecke <hare@xxxxxxx>
CC: Niklas Cassel <niklas.cassel@xxxxxxx>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   15e71592dbae49a674429c618a10401d7f992ac3
commit: 624885209f31eb9985bf51abe204ecbffe2fdeea [2829/11867] scsi: core: Detect support for command duration limits
:::::: branch date: 28 hours ago
:::::: commit date: 4 weeks ago
config: csky-randconfig-c041-20230621 (https://download.01.org/0day-ci/archive/20230622/202306221657.BJHEADkz-lkp@xxxxxxxxx/config)
compiler: csky-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230622/202306221657.BJHEADkz-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Julia Lawall <julia.lawall@xxxxxxxx>
| Closes: https://lore.kernel.org/r/202306221657.BJHEADkz-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/scsi/scsi.c:591:1-3: WARNING: possible condition with no effect (if == else)

vim +591 drivers/scsi/scsi.c

624885209f31eb Damien Le Moal 2023-05-11  574
624885209f31eb Damien Le Moal 2023-05-11  575  static bool scsi_cdl_check_cmd(struct scsi_device *sdev, u8 opcode, u16 sa,
624885209f31eb Damien Le Moal 2023-05-11  576  			       unsigned char *buf)
624885209f31eb Damien Le Moal 2023-05-11  577  {
624885209f31eb Damien Le Moal 2023-05-11  578  	int ret;
624885209f31eb Damien Le Moal 2023-05-11  579  	u8 cdlp;
624885209f31eb Damien Le Moal 2023-05-11  580
624885209f31eb Damien Le Moal 2023-05-11  581  	/* Check operation code */
624885209f31eb Damien Le Moal 2023-05-11  582  	ret = scsi_report_opcode(sdev, buf, SCSI_CDL_CHECK_BUF_LEN, opcode, sa);
624885209f31eb Damien Le Moal 2023-05-11  583  	if (ret <= 0)
624885209f31eb Damien Le Moal 2023-05-11  584  		return false;
624885209f31eb Damien Le Moal 2023-05-11  585
624885209f31eb Damien Le Moal 2023-05-11  586  	if ((buf[1] & 0x03) != 0x03)
624885209f31eb Damien Le Moal 2023-05-11  587  		return false;
624885209f31eb Damien Le Moal 2023-05-11  588
624885209f31eb Damien Le Moal 2023-05-11  589  	/* See SPC-6, one command format of REPORT SUPPORTED OPERATION CODES */
624885209f31eb Damien Le Moal 2023-05-11  590  	cdlp = (buf[1] & 0x18) >> 3;
624885209f31eb Damien Le Moal 2023-05-11 @591  	if (buf[0] & 0x01) {
624885209f31eb Damien Le Moal 2023-05-11  592  		/* rwcdlp == 1 */
624885209f31eb Damien Le Moal 2023-05-11  593  		switch (cdlp) {
624885209f31eb Damien Le Moal 2023-05-11  594  		case 0x01:
624885209f31eb Damien Le Moal 2023-05-11  595  			/* T2A page */
624885209f31eb Damien Le Moal 2023-05-11  596  			return true;
624885209f31eb Damien Le Moal 2023-05-11  597  		case 0x02:
624885209f31eb Damien Le Moal 2023-05-11  598  			/* T2B page */
624885209f31eb Damien Le Moal 2023-05-11  599  			return true;
624885209f31eb Damien Le Moal 2023-05-11  600  		}
624885209f31eb Damien Le Moal 2023-05-11  601  	} else {
624885209f31eb Damien Le Moal 2023-05-11  602  		/* rwcdlp == 0 */
624885209f31eb Damien Le Moal 2023-05-11  603  		switch (cdlp) {
624885209f31eb Damien Le Moal 2023-05-11  604  		case 0x01:
624885209f31eb Damien Le Moal 2023-05-11  605  			/* A page */
624885209f31eb Damien Le Moal 2023-05-11  606  			return true;
624885209f31eb Damien Le Moal 2023-05-11  607  		case 0x02:
624885209f31eb Damien Le Moal 2023-05-11  608  			/* B page */
624885209f31eb Damien Le Moal 2023-05-11  609  			return true;
624885209f31eb Damien Le Moal 2023-05-11  610  		}
624885209f31eb Damien Le Moal 2023-05-11  611  	}
624885209f31eb Damien Le Moal 2023-05-11  612
624885209f31eb Damien Le Moal 2023-05-11  613  	return false;
624885209f31eb Damien Le Moal 2023-05-11  614  }
624885209f31eb Damien Le Moal 2023-05-11  615

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux