linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mike Christie <michael.christie@oracle.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>
Subject: [linux-next:master 211/11867] drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here
Date: Thu, 22 Jun 2023 16:48:03 +0800	[thread overview]
Message-ID: <202306221655.Kwtqi1gI-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   15e71592dbae49a674429c618a10401d7f992ac3
commit: 394f811848827ad23d2b43e94e5d72a24cfbc39f [211/11867] scsi: target: Add block PR support to iblock
config: sparc-randconfig-c003-20230620 (https://download.01.org/0day-ci/archive/20230622/202306221655.Kwtqi1gI-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230622/202306221655.Kwtqi1gI-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306221655.Kwtqi1gI-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here

vim +892 drivers/target/target_core_iblock.c

   837	
   838	static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key,
   839						    u64 sa_key, u8 type, bool aptpl)
   840	{
   841		struct se_device *dev = cmd->se_dev;
   842		struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
   843		struct block_device *bdev = ib_dev->ibd_bd;
   844		const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops;
   845		int ret;
   846	
   847		if (!ops) {
   848			pr_err("Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n");
   849			return TCM_UNSUPPORTED_SCSI_OPCODE;
   850		}
   851	
   852		switch (sa) {
   853		case PRO_REGISTER:
   854		case PRO_REGISTER_AND_IGNORE_EXISTING_KEY:
   855			if (!ops->pr_register) {
   856				pr_err("block device does not support pr_register.\n");
   857				return TCM_UNSUPPORTED_SCSI_OPCODE;
   858			}
   859	
   860			/* The block layer pr ops always enables aptpl */
   861			if (!aptpl)
   862				pr_info("APTPL not set by initiator, but will be used.\n");
   863	
   864			ret = ops->pr_register(bdev, key, sa_key,
   865					sa == PRO_REGISTER ? 0 : PR_FL_IGNORE_KEY);
   866			break;
   867		case PRO_RESERVE:
   868			if (!ops->pr_reserve) {
   869				pr_err("block_device does not support pr_reserve.\n");
   870				return TCM_UNSUPPORTED_SCSI_OPCODE;
   871			}
   872	
   873			ret = ops->pr_reserve(bdev, key, scsi_pr_type_to_block(type), 0);
   874			break;
   875		case PRO_CLEAR:
   876			if (!ops->pr_clear) {
   877				pr_err("block_device does not support pr_clear.\n");
   878				return TCM_UNSUPPORTED_SCSI_OPCODE;
   879			}
   880	
   881			ret = ops->pr_clear(bdev, key);
   882			break;
   883		case PRO_PREEMPT:
   884		case PRO_PREEMPT_AND_ABORT:
   885			if (!ops->pr_clear) {
   886				pr_err("block_device does not support pr_preempt.\n");
   887				return TCM_UNSUPPORTED_SCSI_OPCODE;
   888			}
   889	
   890			ret = ops->pr_preempt(bdev, key, sa_key,
   891					      scsi_pr_type_to_block(type),
 > 892					      sa == PRO_PREEMPT ? false : true);
   893			break;
   894		case PRO_RELEASE:
   895			if (!ops->pr_clear) {
   896				pr_err("block_device does not support pr_pclear.\n");
   897				return TCM_UNSUPPORTED_SCSI_OPCODE;
   898			}
   899	
   900			ret = ops->pr_release(bdev, key, scsi_pr_type_to_block(type));
   901			break;
   902		default:
   903			pr_err("Unknown PERSISTENT_RESERVE_OUT SA: 0x%02x\n", sa);
   904			return TCM_UNSUPPORTED_SCSI_OPCODE;
   905		}
   906	
   907		if (!ret)
   908			return TCM_NO_SENSE;
   909		else if (ret == PR_STS_RESERVATION_CONFLICT)
   910			return TCM_RESERVATION_CONFLICT;
   911		else
   912			return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
   913	}
   914	

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


             reply	other threads:[~2023-06-22  8:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22  8:48 kernel test robot [this message]
2023-06-22 15:34 ` Mike Christie
2023-06-23  1:08   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202306221655.Kwtqi1gI-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-mm@kvack.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox