[PATCH] mtd: nand: pxa3xx: Use info->use_dma to release DMA resources

Ezequiel Garcia ezequiel.garcia at free-electrons.com
Tue Nov 26 07:52:24 EST 2013


After the driver allocates all DMA resources, it sets "info->use_dma".
Therefore, we need to check that variable to decide which resources
needs to be freed, instead of the global use_dma variable.

Without this change, when the device probe fails, the driver will try
to release unallocated DMA resources, with nasty results.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia at free-electrons.com>
---
This is minor fix, but a fix anyway, so it should be queued for stable.

 drivers/mtd/nand/pxa3xx_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 97c3eb5..8f2104c 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1288,7 +1288,7 @@ static int pxa3xx_nand_init_buff(struct pxa3xx_nand_info *info)
 static void pxa3xx_nand_free_buff(struct pxa3xx_nand_info *info)
 {
 	struct platform_device *pdev = info->pdev;
-	if (use_dma) {
+	if (info->use_dma) {
 		pxa_free_dma(info->data_dma_ch);
 		dma_free_coherent(&pdev->dev, info->buf_size,
 				  info->data_buff, info->data_buff_phys);
-- 
1.8.1.5




More information about the linux-mtd mailing list