aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--include/linux/libata.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9fbf0595f3d4..5e324cea3019 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4612,7 +4612,7 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
4612 VPRINTK("unmapping %u sg elements\n", qc->n_elem); 4612 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
4613 4613
4614 if (qc->n_elem) 4614 if (qc->n_elem)
4615 dma_unmap_sg(ap->dev, sg, qc->n_elem, dir); 4615 dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir);
4616 4616
4617 qc->flags &= ~ATA_QCFLAG_DMAMAP; 4617 qc->flags &= ~ATA_QCFLAG_DMAMAP;
4618 qc->sg = NULL; 4618 qc->sg = NULL;
@@ -4727,7 +4727,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
4727 return -1; 4727 return -1;
4728 4728
4729 DPRINTK("%d sg elements mapped\n", n_elem); 4729 DPRINTK("%d sg elements mapped\n", n_elem);
4730 4730 qc->orig_n_elem = qc->n_elem;
4731 qc->n_elem = n_elem; 4731 qc->n_elem = n_elem;
4732 qc->flags |= ATA_QCFLAG_DMAMAP; 4732 qc->flags |= ATA_QCFLAG_DMAMAP;
4733 4733
diff --git a/include/linux/libata.h b/include/linux/libata.h
index dd818c7decd7..fbf064e13ad5 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -530,6 +530,7 @@ struct ata_queued_cmd {
530 unsigned long flags; /* ATA_QCFLAG_xxx */ 530 unsigned long flags; /* ATA_QCFLAG_xxx */
531 unsigned int tag; 531 unsigned int tag;
532 unsigned int n_elem; 532 unsigned int n_elem;
533 unsigned int orig_n_elem;
533 534
534 int dma_dir; 535 int dma_dir;
535 536