mtd: omap2: fix resource leak in prefetch-busy path

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon May 28 07:59:03 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d7efe2281db53544400ac83160a79cf8925598d9
Commit:     d7efe2281db53544400ac83160a79cf8925598d9
Parent:     8da8ba2ea6ad52ea8558384f38586b0c1a516e9d
Author:     Grazvydas Ignotas <notasas at gmail.com>
AuthorDate: Wed Apr 11 04:04:34 2012 +0300
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sun May 13 22:52:10 2012 -0500

    mtd: omap2: fix resource leak in prefetch-busy path
    
    If prefetch engine is busy, current code "forgets" to call
    dma_unmap_single(), which results in a deadlock later, so add it.
    
    Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/omap2.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index c2b0bba..ab56069 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -402,7 +402,7 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr,
 			PREFETCH_FIFOTHRESHOLD_MAX, 0x1, len, is_write);
 	if (ret)
 		/* PFPW engine is busy, use cpu copy method */
-		goto out_copy;
+		goto out_copy_unmap;
 
 	init_completion(&info->comp);
 
@@ -421,6 +421,8 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr,
 	dma_unmap_single(&info->pdev->dev, dma_addr, len, dir);
 	return 0;
 
+out_copy_unmap:
+	dma_unmap_single(&info->pdev->dev, dma_addr, len, dir);
 out_copy:
 	if (info->nand.options & NAND_BUSWIDTH_16)
 		is_write == 0 ? omap_read_buf16(mtd, (u_char *) addr, len)



More information about the linux-mtd-cvs mailing list