1 From 4c6bade4cf80d77decc5ea89fbaadff8b008f5e9 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Mon, 25 Nov 2013 12:35:28 -0300
4 Subject: [PATCH 155/203] mtd: nand: pxa3xx: Use info->use_dma to release DMA
7 After the driver allocates all DMA resources, it sets "info->use_dma".
8 Therefore, we need to check that variable to decide which resources
9 needs to be freed, instead of the global use_dma variable.
11 Without this change, when the device probe fails, the driver will try
12 to release unallocated DMA resources, with nasty results.
14 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
16 drivers/mtd/nand/pxa3xx_nand.c | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
19 --- a/drivers/mtd/nand/pxa3xx_nand.c
20 +++ b/drivers/mtd/nand/pxa3xx_nand.c
21 @@ -1288,7 +1288,7 @@ static int pxa3xx_nand_init_buff(struct
22 static void pxa3xx_nand_free_buff(struct pxa3xx_nand_info *info)
24 struct platform_device *pdev = info->pdev;
26 + if (info->use_dma) {
27 pxa_free_dma(info->data_dma_ch);
28 dma_free_coherent(&pdev->dev, info->buf_size,
29 info->data_buff, info->data_buff_phys);