mtd: maps: Blackfin async: fix memory leaks in probe/remove funcs

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Jun 5 14:59:29 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=4938c88c922fad23f0a9f404eeda0207a819e4df
Commit:     4938c88c922fad23f0a9f404eeda0207a819e4df
Parent:     9f31f4b9dccf6fa4a606ae04602ec232b94727fb
Author:     Mike Frysinger <vapier at gentoo.org>
AuthorDate: Tue Jun 2 00:06:23 2009 -0400
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Jun 5 18:35:44 2009 +0100

    mtd: maps: Blackfin async: fix memory leaks in probe/remove funcs
    
    Signed-off-by: Mike Frysinger <vapier at gentoo.org>
    Signed-off-by: Bryan Wu <cooloney at kernel.org>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/bfin-async-flash.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
index 576611f..365c77b 100644
--- a/drivers/mtd/maps/bfin-async-flash.c
+++ b/drivers/mtd/maps/bfin-async-flash.c
@@ -40,6 +40,9 @@ struct async_state {
 	uint32_t flash_ambctl0, flash_ambctl1;
 	uint32_t save_ambctl0, save_ambctl1;
 	unsigned long irq_flags;
+#ifdef CONFIG_MTD_PARTITIONS
+	struct mtd_partition *parts;
+#endif
 };
 
 static void switch_to_flash(struct async_state *state)
@@ -170,6 +173,7 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev)
 	if (ret > 0) {
 		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
 		add_mtd_partitions(state->mtd, pdata->parts, ret);
+		state->parts = pdata->parts;
 
 	} else if (pdata->nr_parts) {
 		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");
@@ -193,6 +197,7 @@ static int __devexit bfin_flash_remove(struct platform_device *pdev)
 	gpio_free(state->enet_flash_pin);
 #ifdef CONFIG_MTD_PARTITIONS
 	del_mtd_partitions(state->mtd);
+	kfree(state->parts);
 #endif
 	map_destroy(state->mtd);
 	kfree(state);



More information about the linux-mtd-cvs mailing list