From: Grazvydas Ignotas Date: Wed, 11 Apr 2012 01:04:34 +0000 (+0300) Subject: mtd: omap2: fix resource leak in prefetch-busy path X-Git-Tag: MMI-PSA29.97-13-9~16607^2~62 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d7efe2281db53544400ac83160a79cf8925598d9;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index c2b0bba9d8b3..ab56069fa31f 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)