diff mbox

[for,v3.13,1/2] mtd: nand: pxa3xx: Use info->use_dma to release DMA resources

Message ID 1386680236-21698-2-git-send-email-ezequiel.garcia@free-electrons.com
State Superseded
Headers show

Commit Message

Ezequiel Garcia Dec. 10, 2013, 12:57 p.m. UTC
In commit:

  commit 62e8b851783138a11da63285be0fbf69530ff73d
  Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
  Date:   Fri Oct 4 15:30:38 2013 -0300

  mtd: nand: pxa3xx: Allocate data buffer on detected flash size

the way the buffer is allocated was changed: the first READ_ID is issued
with a small kmalloc'ed buffer. Only once the flash page size is detected
the DMA buffers are allocated, and info->use_dma is set.

Currently, if the device detection fails, the driver checks the 'use_dma'
module parameter and tries to release unallocated DMA resources.

Fix this by checking the proper indicator of the DMA allocation, which
is 'info->use_dma'.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/mtd/nand/pxa3xx_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Brian Norris Dec. 12, 2013, 11:03 p.m. UTC | #1
On Tue, Dec 10, 2013 at 09:57:15AM -0300, Ezequiel Garcia wrote:
> In commit:
> 
>   commit 62e8b851783138a11da63285be0fbf69530ff73d
>   Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>   Date:   Fri Oct 4 15:30:38 2013 -0300
> 
>   mtd: nand: pxa3xx: Allocate data buffer on detected flash size
> 
> the way the buffer is allocated was changed: the first READ_ID is issued
> with a small kmalloc'ed buffer. Only once the flash page size is detected
> the DMA buffers are allocated, and info->use_dma is set.
> 
> Currently, if the device detection fails, the driver checks the 'use_dma'
> module parameter and tries to release unallocated DMA resources.
> 
> Fix this by checking the proper indicator of the DMA allocation, which
> is 'info->use_dma'.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Pushed only this patch to linux-mtd.git.

Thanks,
Brian
diff mbox

Patch

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 3d143fe..4cdc134 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);