scsi: hisi_sas: fix return value of hisi_sas_task_prep()

It is an implicit regulation that error code that function returned should
be negative. But hisi_sas_task_prep() doesn't follow this.  This may cause
problems in the upper layer code.

For example, in sas_expander.c of libsas, smp_execute_task_sg() may return
the number of bytes of underrun. It will be conflicted with the scenaio
lldd_execute_task() return an positive error code.

This patch change the return value from SAS_PHY_DOWN to -ECOMM in
hisi_sas_task_prep().

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Xiaofei Tan 2018-03-07 20:25:11 +08:00 committed by Martin K. Petersen
parent 36996a1e6d
commit 6bf6db518c
1 changed files with 3 additions and 3 deletions

View File

@ -316,7 +316,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq
*/
if (device->dev_type != SAS_SATA_DEV)
task->task_done(task);
return SAS_PHY_DOWN;
return -ECOMM;
}
if (DEV_IS_GONE(sas_dev)) {
@ -327,7 +327,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq
dev_info(dev, "task prep: device %016llx not ready\n",
SAS_ADDR(device->sas_addr));
return SAS_PHY_DOWN;
return -ECOMM;
}
port = to_hisi_sas_port(sas_port);
@ -337,7 +337,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq
"SATA/STP" : "SAS",
device->port->id);
return SAS_PHY_DOWN;
return -ECOMM;
}
if (!sas_protocol_ata(task->task_proto)) {