[PATCH 005/117] libsas: Use the host_status and sam_status enums

Bart Van Assche
2021-04-20T00:09:02Z

Allow the compiler to verify the type of the values assigned to the ' hs'
and 'stat' variables.

Cc: John Garry <john.garry@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/libsas/sas_scsi_host.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 1bf939818c98..0be979caf7e3 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -37,7 +37,8 @@
static void sas_end_task(struct scsi_cmnd *sc, struct sas_task *task)
{
struct task_status_struct *ts = &task->task_status;
- int hs = 0, stat = 0;
+ enum host_status hs = 0;
+ enum sam_status stat = 0;

if (ts->resp == SAS_TASK_UNDELIVERED) {
/* transport error */
@@ -88,7 +89,7 @@ static void sas_end_task(struct scsi_cmnd *sc, struct sas_task *task)
stat = SAM_STAT_CHECK_CONDITION;
break;
default:
- stat = ts->stat;
+ stat = (enum sam_status)ts->stat;
break;
}
}