mtd: pxa3xx_nand: fix a memory leak
authorAxel Lin <axel.lin@gmail.com>
Fri, 3 Jun 2011 05:14:10 +0000 (13:14 +0800)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Sun, 11 Sep 2011 12:01:59 +0000 (15:01 +0300)
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@gmail.com>
Acked-by: Lei Wen <leiwen@marvell.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/nand/pxa3xx_nand.c

index 1fb3b3a805818edca37ed2e07bfd8bd90b3d0f4b..f7040ea8dd4bc8cc4ef9aa30904427c4aee9e3b4 100644 (file)
@@ -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;