txx9ndfmc: Use nand_release() to free resources

Submitted by Atsushi Nemoto on Nov. 2, 2009, 2:40 p.m.

Details

Message ID 1257172848-6282-1-git-send-email-anemo@mba.ocn.ne.jp
State Accepted
Commit 6eb4feffb9d619a44fe434e777ef095a29cf4759
Headers show

Commit Message

Atsushi Nemoto Nov. 2, 2009, 2:40 p.m.
This patch fixes memory leak on chip->bbt and chip->buffers.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 drivers/mtd/nand/txx9ndfmc.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Artem Bityutskiy Nov. 9, 2009, 9:40 a.m.
On Mon, 2009-11-02 at 23:40 +0900, Atsushi Nemoto wrote:
> This patch fixes memory leak on chip->bbt and chip->buffers.
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> ---
>  drivers/mtd/nand/txx9ndfmc.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)

Taken to the l2-mtd-2.6 tree, thanks.

Patch hide | download patch | download mbox

diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index 73af832..863513c 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -429,11 +429,10 @@  static int __exit txx9ndfmc_remove(struct platform_device *dev)
 		chip = mtd->priv;
 		txx9_priv = chip->priv;
 
+		nand_release(mtd);
 #ifdef CONFIG_MTD_PARTITIONS
-		del_mtd_partitions(mtd);
 		kfree(drvdata->parts[i]);
 #endif
-		del_mtd_device(mtd);
 		kfree(txx9_priv->mtdname);
 		kfree(txx9_priv);
 	}