Skip to content

Commit

Permalink
mtd: omap2: fix resource leak in prefetch-busy path
Browse files Browse the repository at this point in the history
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@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Grazvydas Ignotas authored and David Woodhouse committed May 14, 2012
1 parent 8da8ba2 commit d7efe22
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mtd/nand/omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
Expand Down

0 comments on commit d7efe22

Please sign in to comment.