diff mbox

[v2,4/4] scsi: pm8001: fix dma_unmap_sg() parameter

Message ID 1515033405-37477-5-git-send-email-chenxiang66@hisilicon.com (mailing list archive)
State Deferred
Headers show

Commit Message

chenxiang Jan. 4, 2018, 2:36 a.m. UTC
For function dma_unmap_sg(), the <nents> parameter should be number of
elements in the scatterlist prior to the mapping, not after the mapping.
Fix this usage.

Cc: Jack Wang <jack_wang@usish.com>
Cc: lindar_liu@usish.com
Fixes: dbf9bfe6("[SCSI]pm8001: add SAS/SATA/HBA driver")
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

chenxiang Jan. 8, 2018, 8:53 a.m. UTC | #1
+cc Jack Wang <xjtuwjp@gmail.com>

在 2018/1/4 10:36, chenxiang 写道:
> For function dma_unmap_sg(), the <nents> parameter should be number of
> elements in the scatterlist prior to the mapping, not after the mapping.
> Fix this usage.
>
> Cc: Jack Wang <jack_wang@usish.com>
> Cc: lindar_liu@usish.com
> Fixes: dbf9bfe6("[SCSI]pm8001: add SAS/SATA/HBA driver")
> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
> ---
>   drivers/scsi/pm8001/pm8001_sas.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index 947d601..576a0f0 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -466,7 +466,7 @@ static int pm8001_task_exec(struct sas_task *task,
>   	dev_printk(KERN_ERR, pm8001_ha->dev, "pm8001 exec failed[%d]!\n", rc);
>   	if (!sas_protocol_ata(t->task_proto))
>   		if (n_elem)
> -			dma_unmap_sg(pm8001_ha->dev, t->scatter, n_elem,
> +			dma_unmap_sg(pm8001_ha->dev, t->scatter, t->num_scatter,
>   				t->data_dir);
>   out_done:
>   	spin_unlock_irqrestore(&pm8001_ha->lock, flags);
diff mbox

Patch

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 947d601..576a0f0 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -466,7 +466,7 @@  static int pm8001_task_exec(struct sas_task *task,
 	dev_printk(KERN_ERR, pm8001_ha->dev, "pm8001 exec failed[%d]!\n", rc);
 	if (!sas_protocol_ata(t->task_proto))
 		if (n_elem)
-			dma_unmap_sg(pm8001_ha->dev, t->scatter, n_elem,
+			dma_unmap_sg(pm8001_ha->dev, t->scatter, t->num_scatter,
 				t->data_dir);
 out_done:
 	spin_unlock_irqrestore(&pm8001_ha->lock, flags);