mtd: OneNAND: OMAP2/3: unmap correct DMA buffer

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon May 10 13:59:02 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=4a70b7d3953c279738a094d2e5ffe7c66b15a5d0
Commit:     4a70b7d3953c279738a094d2e5ffe7c66b15a5d0
Parent:     ac39ee304ac33f15107e42adb5ee5b0d0ce2dc4a
Author:     Mika Westerberg <ext-mika.1.westerberg at nokia.com>
AuthorDate: Wed Mar 24 12:10:48 2010 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon May 10 14:17:05 2010 +0100

    mtd: OneNAND: OMAP2/3: unmap correct DMA buffer
    
    Functions omap2_onenand_write_bufferram() and omap3_onenand_write_bufferram()
    map the write buffer and store the returned handle in variable dma_src. However,
    when DMA unmap is done, variable dma_dst is used instead of the correct dma_src.
    
    This patch fixes them to use the correct DMA buffer.
    
    Signed-off-by: Mika Westerberg <ext-mika.1.westerberg at nokia.com>
    Tested-by: Arnaud Ebalard <arno at natisbad.org>
    Acked-by: Adrian Hunter <adrian.hunter at nokia.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/onenand/omap2.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index dfbab6c..f52934c 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -402,7 +402,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
 
 	dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE);
 	dma_dst = c->phys_base + bram_offset;
-	if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
+	if (dma_mapping_error(&c->pdev->dev, dma_src)) {
 		dev_err(&c->pdev->dev,
 			"Couldn't DMA map a %d byte buffer\n",
 			count);
@@ -425,7 +425,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
 		if (*done)
 			break;
 
-	dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
+	dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
 
 	if (!*done) {
 		dev_err(&c->pdev->dev, "timeout waiting for DMA\n");
@@ -520,7 +520,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
 	dma_src = dma_map_single(&c->pdev->dev, (void *) buffer, count,
 				 DMA_TO_DEVICE);
 	dma_dst = c->phys_base + bram_offset;
-	if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
+	if (dma_mapping_error(&c->pdev->dev, dma_src)) {
 		dev_err(&c->pdev->dev,
 			"Couldn't DMA map a %d byte buffer\n",
 			count);
@@ -538,7 +538,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
 	omap_start_dma(c->dma_channel);
 	wait_for_completion(&c->dma_done);
 
-	dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
+	dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
 
 	return 0;
 }



More information about the linux-mtd-cvs mailing list