mtd: pxa3xx_nand: fix a memory leak

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:05 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=1a3591920e5100ba112a19e10a09ce7a5da1ab23
Commit:     1a3591920e5100ba112a19e10a09ce7a5da1ab23
Parent:     d80932b2dc497faa27e415c12f56f6ae1d087204
Author:     Axel Lin <axel.lin at gmail.com>
AuthorDate: Fri Jun 3 13:14:10 2011 +0800
Committer:  Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Sun Sep 11 15:01:59 2011 +0300

    mtd: pxa3xx_nand: fix a memory leak
    
    In pxa3xx_nand_remove, we should call nand_release instead of
    mtd_device_unregister to properly free bad block table memory
    and bad block descriptor memory.
    
    Signed-off-by: Axel Lin <axel.lin at gmail.com>
    Acked-by: Lei Wen <leiwen at marvell.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 1fb3b3a..f7040ea 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1119,7 +1119,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
 	clk_put(info->clk);
 
 	if (mtd) {
-		mtd_device_unregister(mtd);
+		nand_release(mtd);
 		kfree(mtd);
 	}
 	return 0;



More information about the linux-mtd-cvs mailing list