[PATCH 14/42] scsi: add scsi_result_is_good()

Hannes Reinecke
2021-04-21T17:50:24Z

Add helper to check if the status is 'GOOD', ie if none of the
status bytes are set.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
include/scsi/scsi_cmnd.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 0ac18a7d8ac6..7089617911e1 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -336,6 +336,10 @@ static inline unsigned char get_host_byte(struct scsi_cmnd *cmd)
return (cmd->result >> 16) & 0xff;
}

+static inline bool scsi_result_is_good(struct scsi_cmnd *cmd)
+{
+ return (cmd->result == 0);
+}

static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
{
--
2.29.2