提交 4938c88c 编写于 作者: M Mike Frysinger 提交者: David Woodhouse

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

Signed-off-by: NMike Frysinger <vapier@gentoo.org>
Signed-off-by: NBryan Wu <cooloney@kernel.org>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
上级 9f31f4b9
...@@ -40,6 +40,9 @@ struct async_state { ...@@ -40,6 +40,9 @@ struct async_state {
uint32_t flash_ambctl0, flash_ambctl1; uint32_t flash_ambctl0, flash_ambctl1;
uint32_t save_ambctl0, save_ambctl1; uint32_t save_ambctl0, save_ambctl1;
unsigned long irq_flags; unsigned long irq_flags;
#ifdef CONFIG_MTD_PARTITIONS
struct mtd_partition *parts;
#endif
}; };
static void switch_to_flash(struct async_state *state) static void switch_to_flash(struct async_state *state)
...@@ -170,6 +173,7 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) ...@@ -170,6 +173,7 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev)
if (ret > 0) { if (ret > 0) {
pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n"); pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
add_mtd_partitions(state->mtd, pdata->parts, ret); add_mtd_partitions(state->mtd, pdata->parts, ret);
state->parts = pdata->parts;
} else if (pdata->nr_parts) { } else if (pdata->nr_parts) {
pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n"); 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) ...@@ -193,6 +197,7 @@ static int __devexit bfin_flash_remove(struct platform_device *pdev)
gpio_free(state->enet_flash_pin); gpio_free(state->enet_flash_pin);
#ifdef CONFIG_MTD_PARTITIONS #ifdef CONFIG_MTD_PARTITIONS
del_mtd_partitions(state->mtd); del_mtd_partitions(state->mtd);
kfree(state->parts);
#endif #endif
map_destroy(state->mtd); map_destroy(state->mtd);
kfree(state); kfree(state);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册