linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: pxa3xx: Use info->use_dma to release DMA resources
@ 2013-11-26 12:52 Ezequiel Garcia
  2013-11-27  7:58 ` Brian Norris
  0 siblings, 1 reply; 9+ messages in thread
From: Ezequiel Garcia @ 2013-11-26 12:52 UTC (permalink / raw)
  To: linux-mtd; +Cc: Brian Norris, Ezequiel Garcia

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@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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-12-10 12:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-26 12:52 [PATCH] mtd: nand: pxa3xx: Use info->use_dma to release DMA resources Ezequiel Garcia
2013-11-27  7:58 ` Brian Norris
2013-11-27 11:34   ` Ezequiel Garcia
2013-12-06 10:53     ` Ezequiel Garcia
2013-12-09 21:20       ` Ezequiel Garcia
2013-12-09 21:55     ` Brian Norris
2013-12-09 22:32       ` Ezequiel Garcia
2013-12-09 23:10         ` Brian Norris
2013-12-10 12:59           ` Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).