All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 211/11867] drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here
@ 2023-06-22  8:48 kernel test robot
  2023-06-22 15:34 ` Mike Christie
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2023-06-22  8:48 UTC (permalink / raw)
  To: Mike Christie
  Cc: oe-kbuild-all, Linux Memory Management List, Martin K. Petersen,
	Christoph Hellwig, Hannes Reinecke

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-next:master 211/11867] drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here
  2023-06-22  8:48 [linux-next:master 211/11867] drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here kernel test robot
@ 2023-06-22 15:34 ` Mike Christie
  2023-06-23  1:08   ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Christie @ 2023-06-22 15:34 UTC (permalink / raw)
  To: kernel test robot
  Cc: oe-kbuild-all, Linux Memory Management List, Martin K. Petersen,
	Christoph Hellwig, Hannes Reinecke

On 6/22/23 3:48 AM, kernel test robot wrote:
> 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
> 


>    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);


The kernel test robot is correct. I can do the patch below.

Martin, do you want me to just submit the patch below to linux-scsi or
fold it into:

commit 394f811848827ad23d2b43e94e5d72a24cfbc39f
Author: Mike Christie <michael.christie@oracle.com>
Date:   Fri Apr 7 15:05:51 2023 -0500

    scsi: target: Add block PR support to iblock

and re-submit that whole patch?


From 96f7e2fa06cd39f2e661530ae14160286f189fbb Mon Sep 17 00:00:00 2001
From: Mike Christie <michael.christie@oracle.com>
Date: Thu, 22 Jun 2023 10:30:12 -0500
Subject: [PATCH] scsi: target: Quiet bool conversion warning with pr_preempt
 use

We want to pass in true for pr_preempt's argument if we are doing a
PRO_PREEMPT_AND_ABORT, so just test sa against PRO_PREEMPT_AND_ABORT, and
pass the result to pr_preempt.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306221655.Kwtqi1gI-lkp@intel.com/
Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/target/target_core_iblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index a3c5f3558a33..3d1b511ea284 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -888,7 +888,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key,
 
 		ret = ops->pr_preempt(bdev, key, sa_key,
 				      scsi_pr_type_to_block(type),
-				      sa == PRO_PREEMPT ? false : true);
+				      sa == PRO_PREEMPT_AND_ABORT);
 		break;
 	case PRO_RELEASE:
 		if (!ops->pr_clear) {
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [linux-next:master 211/11867] drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here
  2023-06-22 15:34 ` Mike Christie
@ 2023-06-23  1:08   ` Martin K. Petersen
  0 siblings, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2023-06-23  1:08 UTC (permalink / raw)
  To: Mike Christie
  Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List,
	Martin K. Petersen, Christoph Hellwig, Hannes Reinecke


Mike,

> Martin, do you want me to just submit the patch below to linux-scsi or
> fold it into:

Please submit the incremental patch. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-23  1:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-22  8:48 [linux-next:master 211/11867] drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here kernel test robot
2023-06-22 15:34 ` Mike Christie
2023-06-23  1:08   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.