Skip to contentSkip to conversation

mtd: pxa3xx_nand: fix a memory leak

PATCH Applied Axel Lin 4 participants 5 messages Jun 3, 2011 – Jun 6, 2011

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 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.

---
 drivers/mtd/nand/pxa3xx_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +1 -1
index 1fb3b3a..f7040ea 100644
@@ -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;
Signature · 1 line
1.7.4.1
author
#1 lore raw

PATCH 2/2 mtd: fsmc_nand: fix a memory leak

In fsmc_nand_remove, we should call nand_release instead of mtd_device_unregister to properly free bad block table memory and bad block descriptor memory.

---
 drivers/mtd/nand/fsmc_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/fsmc_nand.c +1 -1
index e9b275a..8a5f1aa 100644
@@ -822,7 +822,7 @@ static int fsmc_nand_remove(struct platform_device *pdev)
 	platform_set_drvdata(pdev, NULL);
 
 	if (host) {
-		mtd_device_unregister(&host->mtd);
+		nand_release(&host->mtd);
 		clk_disable(host->clk);
 		clk_put(host->clk);
 
Signature · 1 line
1.7.4.1
#2 lore raw
In reply to Axel Lin

(Cc Lei Wen)

Quoted 33 lines · Axel Lin

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.

---
 drivers/mtd/nand/pxa3xx_nand.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +1 -2
index 1fb3b3a..f7040ea 100644
@@ -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;
--

1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Acked-by
#3 lore raw
Quoted 19 lines · Daniel Mack

(Cc Lei Wen)

Quoted 16 lines · Axel Lin

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.

---
 drivers/mtd/nand/pxa3xx_nand.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +0 -0
index 1fb3b3a..f7040ea 100644
@@ -1119,7 +1119,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
        clk_put(info->clk);
 
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/pxa3xx_nand.c +1 -2
        if (mtd) {
-               mtd_device_unregister(mtd);
+               nand_release(mtd);
                kfree(mtd);
        }
        return 0;
--

1.7.4.1

#4 lore raw
In reply to Axel Lin
Quoted 5 lines · Axel Lin

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.

Pushed to l2-mtd-2.6.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)