diff mbox series

[3/3] scsi: switch to use scsi_result_is_good() in scsi_result_to_blk_status()

Message ID 20210319030128.1345061-4-yanaijie@huawei.com
State New
Headers show
Series [1/3] scsi: check the whole result for reading write protect flag | expand

Commit Message

Jason Yan March 19, 2021, 3:01 a.m. UTC
Use scsi_result_is_good() to simplify the code.

Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hannes Reinecke March 19, 2021, 7:56 a.m. UTC | #1
On 3/19/21 4:01 AM, Jason Yan wrote:
> Use scsi_result_is_good() to simplify the code.
> 
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> ---
>   drivers/scsi/scsi_lib.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 7d52a11e1b61..d1ec9f6a93f0 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -626,7 +626,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
>   		 * to handle the case when a SCSI LLD sets result to
>   		 * DRIVER_SENSE << 24 without setting SAM_STAT_CHECK_CONDITION.
>   		 */
> -		if (scsi_status_is_good(result) && (result & ~0xff) == 0)
> +		if (scsi_result_is_good(result))
>   			return BLK_STS_OK;
>   		return BLK_STS_IOERR;
>   	case DID_TRANSPORT_FAILFAST:
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 7d52a11e1b61..d1ec9f6a93f0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -626,7 +626,7 @@  static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
 		 * to handle the case when a SCSI LLD sets result to
 		 * DRIVER_SENSE << 24 without setting SAM_STAT_CHECK_CONDITION.
 		 */
-		if (scsi_status_is_good(result) && (result & ~0xff) == 0)
+		if (scsi_result_is_good(result))
 			return BLK_STS_OK;
 		return BLK_STS_IOERR;
 	case DID_TRANSPORT_FAILFAST: