Skip to content

Commit 4938c88

Browse files
vapierDavid Woodhouse
authored andcommitted
mtd: maps: Blackfin async: fix memory leaks in probe/remove funcs
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 9f31f4b commit 4938c88

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/mtd/maps/bfin-async-flash.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ struct async_state {
4040
uint32_t flash_ambctl0, flash_ambctl1;
4141
uint32_t save_ambctl0, save_ambctl1;
4242
unsigned long irq_flags;
43+
#ifdef CONFIG_MTD_PARTITIONS
44+
struct mtd_partition *parts;
45+
#endif
4346
};
4447

4548
static void switch_to_flash(struct async_state *state)
@@ -170,6 +173,7 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev)
170173
if (ret > 0) {
171174
pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
172175
add_mtd_partitions(state->mtd, pdata->parts, ret);
176+
state->parts = pdata->parts;
173177

174178
} else if (pdata->nr_parts) {
175179
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)
193197
gpio_free(state->enet_flash_pin);
194198
#ifdef CONFIG_MTD_PARTITIONS
195199
del_mtd_partitions(state->mtd);
200+
kfree(state->parts);
196201
#endif
197202
map_destroy(state->mtd);
198203
kfree(state);

0 commit comments

Comments
 (0)