summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/redwood.c
diff options
context:
space:
mode:
authorAmol Lad <amol@verismonetworks.com>2006-09-21 14:42:43 +0200
committerDavid Woodhouse <dwmw2@infradead.org>2006-09-22 11:24:31 +0200
commit25f0c659fe64832d8ee06aa623fffaad708dcf8b (patch)
treeb5740156ac2ce5e39aaaba32ddb21b03379abb48 /drivers/mtd/maps/redwood.c
parent[MTD] Switch to pci_get_device and do ref counting (diff)
downloadlinux-25f0c659fe64832d8ee06aa623fffaad708dcf8b.tar.xz
linux-25f0c659fe64832d8ee06aa623fffaad708dcf8b.zip
ioremap balanced with iounmap for drivers/mtd subsystem
ioremap must be balanced by an iounmap and failing to do so can result in a memory leak. Tested (compilation only) with: - allmodconfig - Modifying drivers/mtd/maps/Kconfig and drivers/mtd/nand/Kconfig to make sure that the changed file is compiling without warning Signed-off-by: Amol Lad <amol@verismonetworks.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/maps/redwood.c')
-rw-r--r--drivers/mtd/maps/redwood.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/maps/redwood.c b/drivers/mtd/maps/redwood.c
index ec8fdae1dd99..2257d2b500c0 100644
--- a/drivers/mtd/maps/redwood.c
+++ b/drivers/mtd/maps/redwood.c
@@ -126,6 +126,8 @@ static struct mtd_info *redwood_mtd;
int __init init_redwood_flash(void)
{
+ int err = 0;
+
printk(KERN_NOTICE "redwood: flash mapping: %x at %x\n",
WINDOW_SIZE, WINDOW_ADDR);
@@ -141,11 +143,18 @@ int __init init_redwood_flash(void)
if (redwood_mtd) {
redwood_mtd->owner = THIS_MODULE;
- return add_mtd_partitions(redwood_mtd,
+ err = add_mtd_partitions(redwood_mtd,
redwood_flash_partitions,
NUM_REDWOOD_FLASH_PARTITIONS);
+ if (err) {
+ printk("init_redwood_flash: add_mtd_partitions failed\n");
+ iounmap(redwood_flash_map.virt);
+ }
+ return err;
+
}
+ iounmap(redwood_flash_map.virt);
return -ENXIO;
}