Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7efe228 authored by Grazvydas Ignotas's avatar Grazvydas Ignotas Committed by David Woodhouse
Browse files

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: default avatarGrazvydas Ignotas <notasas@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 8da8ba2e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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)