Skip to contentSkip to conversation

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

PATCH Applied Grazvydas Ignotas 2 participants 2 messages Apr 11, 2012 – Apr 22, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/mtd/nand/omap2.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mtd/nand/omap2.c +3 -1
index f745f00..7feb274 100644
@@ -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)
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 4 lines · Grazvydas Ignotas

If prefetch engine is busy, current code "forgets" to call dma_unmap_single(), which results in a deadlock later, so add it.

Pushed to l2-mtd.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy