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 |
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 --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:
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(-)