aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZheng Yongjun <[email protected]>2022-11-19 07:33:07 +0000
committerMiquel Raynal <[email protected]>2022-11-24 12:33:38 +0100
commit2399401feee27c639addc5b7e6ba519d3ca341bf (patch)
treee9a25b68a58abe4cca109f4563cc1f3e426a0688
parent56570bdad5e31c5c538cd6efff5c4510256e1bb4 (diff)
mtd: maps: pxa2xx-flash: fix memory leak in probe
Free 'info' upon remapping error to avoid a memory leak. Fixes: e644f7d62894 ("[MTD] MAPS: Merge Lubbock and Mainstone drivers into common PXA2xx driver") Signed-off-by: Zheng Yongjun <[email protected]> [<[email protected]>: Reword the commit log] Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
-rw-r--r--drivers/mtd/maps/pxa2xx-flash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 1749dbbacc13..62a5bf41a6d7 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -64,6 +64,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
if (!info->map.virt) {
printk(KERN_WARNING "Failed to ioremap %s\n",
info->map.name);
+ kfree(info);
return -ENOMEM;
}
info->map.cached = ioremap_cache(info->map.phys, info->map.size);
@@ -85,6 +86,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
iounmap((void *)info->map.virt);
if (info->map.cached)
iounmap(info->map.cached);
+ kfree(info);
return -EIO;
}
info->mtd->dev.parent = &pdev->dev;