mtd/maps: blackfin async flash maps: fix up memory leak
PATCH 4/4 mtd/maps: blackfin async flash maps: fix up memory leak
From: Mike Frysinger <[email protected]>
---
drivers/mtd/maps/bfin-async-flash.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/maps/bfin-async-flash.c renamed from drivers/mtd/maps/bfin-async-flash.c~mtd-maps-blackfin-async-flash-maps-fix-up-memory-leak +1 -0
@@ -170,6 +170,7 @@ static int __devinit bfin_flash_probe(stif (ret >0 ) { pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");add_mtd_partitions (state->mtd, pdata->parts, ret); +kfree (pdata->parts); }else if (pdata->nr_parts) { pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");
_
drivers/mtd/maps/bfin-async-flash.c static int __devinit bfin_flash_probe(st · line 176
Quoted 8 lines · On Wed, 11 Feb 2009 13:12:19 -0800, [email protected] wrote:
drivers/mtd/maps/bfin-async-flash.c renamed from drivers/mtd/maps/bfin-async-flash.c~mtd-maps-blackfin-async-flash-maps-fix-up-memory-leak +1
-0@@ -170,6 +170,7 @@ static int __devinit bfin_flash_probe(stif (ret >0 ) { pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");add_mtd_partitions (state->mtd, pdata->parts, ret); +kfree (pdata->parts); }else if (pdata->nr_parts) { pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");
As Matthias Kaehlcke pointed out in mail titled "[BUG] physmap_flash_probe() frees memory still in use", this fix introduce another bug.
Revised patch for physmap driver is:
http://lists.infradead.org/pipermail/linux-mtd/2009-February/024590.html
Mike, please update this blackfin patch too.
---
Atsushi Nemoto
Quoted 14 lines · On Thu, 12 Feb 2009 09:35:31 +0900 (JST) Atsushi Nemoto <[email protected]>…
drivers/mtd/maps/bfin-async-flash.c static int __devinit bfin_flash_probe(st · line 176
Quoted 8 lines · On Wed, 11 Feb 2009 13:12:19 -0800, [email protected] wrote:
drivers/mtd/maps/bfin-async-flash.c renamed from drivers/mtd/maps/bfin-async-flash.c~mtd-maps-blackfin-async-flash-maps-fix-up-memory-leak +1
-0@@ -170,6 +170,7 @@ static int __devinit bfin_flash_probe(stif (ret >0 ) { pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");add_mtd_partitions (state->mtd, pdata->parts, ret); +kfree (pdata->parts); }else if (pdata->nr_parts) { pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");As Matthias Kaehlcke pointed out in mail titled "[BUG]
physmap_flash_probe()frees memory still in use", this fix introduce another bug.
Quoted 5 lines
Revised patch for physmap driver is:
http://lists.infradead.org/pipermail/linux-mtd/2009-February/024590.htmlMike, please update this blackfin patch too.
I don't have a copy of that patch. You're on you own, guys..
Quoted 10 lines · Andrew Morton
Quoted 4 lines
Revised patch for physmap driver is:
http://lists.infradead.org/pipermail/linux-mtd/2009-February/024590.html
Quoted 3 lines
Mike, please update this blackfin patch too.
I don't have a copy of that patch. You're on you own, guys..
Er, wasn't your [1/4] actually Nemoto-san's latest physmap patch?
Mike, please can I have an updated version of the blackfin patch?
Nemoto-san, thank you for taking care of this.
Signature · 1 line
dwmw2
Quoted 8 lines · David Woodhouse
Quoted 7 lines · Andrew Morton
Quoted 2 lines
Revised patch for physmap driver is:
http://lists.infradead.org/pipermail/linux-mtd/2009-February/024590.html
Quoted 3 lines
Mike, please update this blackfin patch too.
Quoted 7 lines
Quoted 1 line
I don't have a copy of that patch. You're on you own, guys..
Er, wasn't your [1/4] actually Nemoto-san's latest physmap patch?
Mike, please can I have an updated version of the blackfin patch?
Nemoto-san, thank you for taking care of this.
i'm not entirely sure what the change is by reading that patch. what i've got is attached.
-mike
drivers/mtd/maps/bfin-async-flash.c +5 -0
@@ -41,4 +41,7 @@uint32_t save_ambctl0, save_ambctl1;unsigned long irq_flags; +#ifdef CONFIG_MTD_PARTITIONS +struct mtd_partition *parts; +#endif };
@@ -167,4 +174,5 @@ 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) {
@@ -190,4 +198,5 @@#ifdef CONFIG_MTD_PARTITIONS del_mtd_partitions (state->mtd); +kfree (state->parts);#endif map_destroy (state->mtd);
Quoted 2 lines · Mike Frysinger
i'm not entirely sure what the change is by reading that patch. what i've got is attached.
Looks fine for me. Thanks.
---
Atsushi Nemoto
Quoted 5 lines · Atsushi Nemoto
Quoted 2 lines · Mike Frysinger
i'm not entirely sure what the change is by reading that patch. what i've got is attached.
Looks fine for me. Thanks.
ok, i'll wait for my other patches against bfin-async-flash to make it into mainline and i'll post a follow up patch for this. -mike