diff options
author | Amol Lad <amol@verismonetworks.com> | 2006-09-21 08:42:43 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-09-22 05:24:31 -0400 |
commit | 25f0c659fe64832d8ee06aa623fffaad708dcf8b (patch) | |
tree | b5740156ac2ce5e39aaaba32ddb21b03379abb48 /drivers/mtd/nand/ppchameleonevb.c | |
parent | dd8e9ed6ed544e2b924429d29cd2a6b55590109b (diff) |
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/nand/ppchameleonevb.c')
-rw-r--r-- | drivers/mtd/nand/ppchameleonevb.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mtd/nand/ppchameleonevb.c b/drivers/mtd/nand/ppchameleonevb.c index 22fa65c12ab9..eb7d4d443deb 100644 --- a/drivers/mtd/nand/ppchameleonevb.c +++ b/drivers/mtd/nand/ppchameleonevb.c | |||
@@ -276,6 +276,7 @@ static int __init ppchameleonevb_init(void) | |||
276 | /* Scan to find existence of the device (it could not be mounted) */ | 276 | /* Scan to find existence of the device (it could not be mounted) */ |
277 | if (nand_scan(ppchameleon_mtd, 1)) { | 277 | if (nand_scan(ppchameleon_mtd, 1)) { |
278 | iounmap((void *)ppchameleon_fio_base); | 278 | iounmap((void *)ppchameleon_fio_base); |
279 | ppchameleon_fio_base = NULL; | ||
279 | kfree(ppchameleon_mtd); | 280 | kfree(ppchameleon_mtd); |
280 | goto nand_evb_init; | 281 | goto nand_evb_init; |
281 | } | 282 | } |
@@ -314,6 +315,8 @@ static int __init ppchameleonevb_init(void) | |||
314 | ppchameleonevb_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); | 315 | ppchameleonevb_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); |
315 | if (!ppchameleonevb_mtd) { | 316 | if (!ppchameleonevb_mtd) { |
316 | printk("Unable to allocate PPChameleonEVB NAND MTD device structure.\n"); | 317 | printk("Unable to allocate PPChameleonEVB NAND MTD device structure.\n"); |
318 | if (ppchameleon_fio_base) | ||
319 | iounmap(ppchameleon_fio_base); | ||
317 | return -ENOMEM; | 320 | return -ENOMEM; |
318 | } | 321 | } |
319 | 322 | ||
@@ -322,6 +325,8 @@ static int __init ppchameleonevb_init(void) | |||
322 | if (!ppchameleonevb_fio_base) { | 325 | if (!ppchameleonevb_fio_base) { |
323 | printk("ioremap PPChameleonEVB NAND flash failed\n"); | 326 | printk("ioremap PPChameleonEVB NAND flash failed\n"); |
324 | kfree(ppchameleonevb_mtd); | 327 | kfree(ppchameleonevb_mtd); |
328 | if (ppchameleon_fio_base) | ||
329 | iounmap(ppchameleon_fio_base); | ||
325 | return -EIO; | 330 | return -EIO; |
326 | } | 331 | } |
327 | 332 | ||
@@ -378,6 +383,8 @@ static int __init ppchameleonevb_init(void) | |||
378 | if (nand_scan(ppchameleonevb_mtd, 1)) { | 383 | if (nand_scan(ppchameleonevb_mtd, 1)) { |
379 | iounmap((void *)ppchameleonevb_fio_base); | 384 | iounmap((void *)ppchameleonevb_fio_base); |
380 | kfree(ppchameleonevb_mtd); | 385 | kfree(ppchameleonevb_mtd); |
386 | if (ppchameleon_fio_base) | ||
387 | iounmap(ppchameleon_fio_base); | ||
381 | return -ENXIO; | 388 | return -ENXIO; |
382 | } | 389 | } |
383 | #ifdef CONFIG_MTD_PARTITIONS | 390 | #ifdef CONFIG_MTD_PARTITIONS |