diff options
author | Bart Van Assche <bvanassche@acm.org> | 2021-05-23 19:54:56 -0700 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-06-02 23:09:39 -0400 |
commit | 149d0e489e807f1e6dc265f975a793cea11ecbea (patch) | |
tree | a0e16e90e239694ff6a13f0551dd55a07be67985 /drivers | |
parent | d377f415dddc18b33c88dcd41cfe4fe6d9db82fb (diff) | |
download | linux-stable-149d0e489e807f1e6dc265f975a793cea11ecbea.tar.gz linux-stable-149d0e489e807f1e6dc265f975a793cea11ecbea.tar.bz2 linux-stable-149d0e489e807f1e6dc265f975a793cea11ecbea.zip |
scsi: core: Introduce enums for the SAM and host status codes
Make it possible for the compiler to verify whether SAM and host
status codes are used correctly.
[mkp: resolve conflicts with Hannes' SCSI result series]
Link: https://lore.kernel.org/r/20210524025457.11299-3-bvanassche@acm.org
Cc: Hannes Reinecke <hare@suse.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/constants.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_pscsi.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 41bcfed08260..340785536998 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -408,8 +408,8 @@ static const char * const hostbyte_table[]={ const char *scsi_hostbyte_string(int result) { + enum scsi_host_status hb = host_byte(result); const char *hb_string = NULL; - int hb = host_byte(result); if (hb < ARRAY_SIZE(hostbyte_table)) hb_string = hostbyte_table[hb]; diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index e2b97cba6679..1646ba8eda11 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -1044,7 +1044,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status) struct se_cmd *cmd = req->end_io_data; struct pscsi_plugin_task *pt = cmd->priv; int result = scsi_req(req)->result; - u8 scsi_status = result & 0xff; + enum sam_status scsi_status = result & 0xff; if (scsi_status != SAM_STAT_GOOD) { pr_debug("PSCSI Status Byte exception at cmd: %p CDB:" |