Commit 8b865d5e authored by Mike Frysinger's avatar Mike Frysinger Committed by David Woodhouse

mtd: Blackfin NFC: fix invalid free in remove()

Since info->mtd isn't dynamically allocated, we shouldn't attempt to
kfree() it.  Otherwise we get random fun corruption when unloading
the driver built as a module.
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent eac15a42
...@@ -682,7 +682,6 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info) ...@@ -682,7 +682,6 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
static int __devexit bf5xx_nand_remove(struct platform_device *pdev) static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
{ {
struct bf5xx_nand_info *info = to_nand_info(pdev); struct bf5xx_nand_info *info = to_nand_info(pdev);
struct mtd_info *mtd = NULL;
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
...@@ -690,11 +689,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev) ...@@ -690,11 +689,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
* and their partitions, then go through freeing the * and their partitions, then go through freeing the
* resources used * resources used
*/ */
mtd = &info->mtd; nand_release(&info->mtd);
if (mtd) {
nand_release(mtd);
kfree(mtd);
}
peripheral_free_list(bfin_nfc_pin_req); peripheral_free_list(bfin_nfc_pin_req);
bf5xx_nand_dma_remove(info); bf5xx_nand_dma_remove(info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment