Re: [linux-next:master 211/11867] drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here

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

 



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@xxxxxxxxx/config)
> compiler: sparc-linux-gcc (GCC) 12.3.0
> reproduce: (https://download.01.org/0day-ci/archive/20230622/202306221655.Kwtqi1gI-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>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306221655.Kwtqi1gI-lkp@xxxxxxxxx/
> 
> 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@xxxxxxxxxx>
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@xxxxxxxxxx>
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@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202306221655.Kwtqi1gI-lkp@xxxxxxxxx/
Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx>
---
 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






[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