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 | |
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>
-rw-r--r-- | drivers/mtd/maps/arctic-mtd.c | 14 | ||||
-rw-r--r-- | drivers/mtd/maps/beech-mtd.c | 14 | ||||
-rw-r--r-- | drivers/mtd/maps/cstm_mips_ixx.c | 18 | ||||
-rw-r--r-- | drivers/mtd/maps/ebony.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/fortunet.c | 3 | ||||
-rw-r--r-- | drivers/mtd/maps/lasat.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/nettel.c | 34 | ||||
-rw-r--r-- | drivers/mtd/maps/ocotea.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/redwood.c | 11 | ||||
-rw-r--r-- | drivers/mtd/maps/sbc8240.c | 11 | ||||
-rw-r--r-- | drivers/mtd/maps/walnut.c | 4 | ||||
-rw-r--r-- | drivers/mtd/nand/edb7312.c | 3 | ||||
-rw-r--r-- | drivers/mtd/nand/ppchameleonevb.c | 7 | ||||
-rw-r--r-- | include/linux/utsrelease.h | 1 |
15 files changed, 119 insertions, 15 deletions
diff --git a/drivers/mtd/maps/arctic-mtd.c b/drivers/mtd/maps/arctic-mtd.c index d95ae582fbe9..642d96bc8919 100644 --- a/drivers/mtd/maps/arctic-mtd.c +++ b/drivers/mtd/maps/arctic-mtd.c | |||
@@ -96,6 +96,8 @@ static struct mtd_partition arctic_partitions[PARTITIONS] = { | |||
96 | static int __init | 96 | static int __init |
97 | init_arctic_mtd(void) | 97 | init_arctic_mtd(void) |
98 | { | 98 | { |
99 | int err = 0; | ||
100 | |||
99 | printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR); | 101 | printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR); |
100 | 102 | ||
101 | arctic_mtd_map.virt = ioremap(PADDR, SIZE); | 103 | arctic_mtd_map.virt = ioremap(PADDR, SIZE); |
@@ -109,12 +111,20 @@ init_arctic_mtd(void) | |||
109 | printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8); | 111 | printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8); |
110 | arctic_mtd = do_map_probe("cfi_probe", &arctic_mtd_map); | 112 | arctic_mtd = do_map_probe("cfi_probe", &arctic_mtd_map); |
111 | 113 | ||
112 | if (!arctic_mtd) | 114 | if (!arctic_mtd) { |
115 | iounmap((void *) arctic_mtd_map.virt); | ||
113 | return -ENXIO; | 116 | return -ENXIO; |
117 | } | ||
114 | 118 | ||
115 | arctic_mtd->owner = THIS_MODULE; | 119 | arctic_mtd->owner = THIS_MODULE; |
116 | 120 | ||
117 | return add_mtd_partitions(arctic_mtd, arctic_partitions, PARTITIONS); | 121 | err = add_mtd_partitions(arctic_mtd, arctic_partitions, PARTITIONS); |
122 | if (err) { | ||
123 | printk("%s: add_mtd_partitions failed\n", NAME); | ||
124 | iounmap((void *) arctic_mtd_map.virt); | ||
125 | } | ||
126 | |||
127 | return err; | ||
118 | } | 128 | } |
119 | 129 | ||
120 | static void __exit | 130 | static void __exit |
diff --git a/drivers/mtd/maps/beech-mtd.c b/drivers/mtd/maps/beech-mtd.c index 5df7361d1407..a64b1a5ab316 100644 --- a/drivers/mtd/maps/beech-mtd.c +++ b/drivers/mtd/maps/beech-mtd.c | |||
@@ -72,6 +72,8 @@ static struct mtd_partition beech_partitions[2] = { | |||
72 | static int __init | 72 | static int __init |
73 | init_beech_mtd(void) | 73 | init_beech_mtd(void) |
74 | { | 74 | { |
75 | int err = 0; | ||
76 | |||
75 | printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR); | 77 | printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR); |
76 | 78 | ||
77 | beech_mtd_map.virt = ioremap(PADDR, SIZE); | 79 | beech_mtd_map.virt = ioremap(PADDR, SIZE); |
@@ -86,12 +88,20 @@ init_beech_mtd(void) | |||
86 | printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8); | 88 | printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8); |
87 | beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map); | 89 | beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map); |
88 | 90 | ||
89 | if (!beech_mtd) | 91 | if (!beech_mtd) { |
92 | iounmap((void *) beech_mtd_map.virt); | ||
90 | return -ENXIO; | 93 | return -ENXIO; |
94 | } | ||
91 | 95 | ||
92 | beech_mtd->owner = THIS_MODULE; | 96 | beech_mtd->owner = THIS_MODULE; |
93 | 97 | ||
94 | return add_mtd_partitions(beech_mtd, beech_partitions, 2); | 98 | err = add_mtd_partitions(beech_mtd, beech_partitions, 2); |
99 | if (err) { | ||
100 | printk("%s: add_mtd_partitions failed\n", NAME); | ||
101 | iounmap((void *) beech_mtd_map.virt); | ||
102 | } | ||
103 | |||
104 | return err; | ||
95 | } | 105 | } |
96 | 106 | ||
97 | static void __exit | 107 | static void __exit |
diff --git a/drivers/mtd/maps/cstm_mips_ixx.c b/drivers/mtd/maps/cstm_mips_ixx.c index aa56defb94c8..d6bef100d69a 100644 --- a/drivers/mtd/maps/cstm_mips_ixx.c +++ b/drivers/mtd/maps/cstm_mips_ixx.c | |||
@@ -171,7 +171,14 @@ int __init init_cstm_mips_ixx(void) | |||
171 | cstm_mips_ixx_map[i].phys = cstm_mips_ixx_board_desc[i].window_addr; | 171 | cstm_mips_ixx_map[i].phys = cstm_mips_ixx_board_desc[i].window_addr; |
172 | cstm_mips_ixx_map[i].virt = ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size); | 172 | cstm_mips_ixx_map[i].virt = ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size); |
173 | if (!cstm_mips_ixx_map[i].virt) { | 173 | if (!cstm_mips_ixx_map[i].virt) { |
174 | int j = 0; | ||
174 | printk(KERN_WARNING "Failed to ioremap\n"); | 175 | printk(KERN_WARNING "Failed to ioremap\n"); |
176 | for (j = 0; j < i; j++) { | ||
177 | if (cstm_mips_ixx_map[j].virt) { | ||
178 | iounmap((void *)cstm_mips_ixx_map[j].virt); | ||
179 | cstm_mips_ixx_map[j].virt = 0; | ||
180 | } | ||
181 | } | ||
175 | return -EIO; | 182 | return -EIO; |
176 | } | 183 | } |
177 | cstm_mips_ixx_map[i].name = cstm_mips_ixx_board_desc[i].name; | 184 | cstm_mips_ixx_map[i].name = cstm_mips_ixx_board_desc[i].name; |
@@ -204,8 +211,15 @@ int __init init_cstm_mips_ixx(void) | |||
204 | cstm_mips_ixx_map[i].map_priv_2 = (unsigned long)mymtd; | 211 | cstm_mips_ixx_map[i].map_priv_2 = (unsigned long)mymtd; |
205 | add_mtd_partitions(mymtd, parts, cstm_mips_ixx_board_desc[i].num_partitions); | 212 | add_mtd_partitions(mymtd, parts, cstm_mips_ixx_board_desc[i].num_partitions); |
206 | } | 213 | } |
207 | else | 214 | else { |
208 | return -ENXIO; | 215 | for (i = 0; i < PHYSMAP_NUMBER; i++) { |
216 | if (cstm_mips_ixx_map[i].virt) { | ||
217 | iounmap((void *)cstm_mips_ixx_map[i].virt); | ||
218 | cstm_mips_ixx_map[i].virt = 0; | ||
219 | } | ||
220 | } | ||
221 | return -ENXIO; | ||
222 | } | ||
209 | } | 223 | } |
210 | return 0; | 224 | return 0; |
211 | } | 225 | } |
diff --git a/drivers/mtd/maps/ebony.c b/drivers/mtd/maps/ebony.c index 641e1dd8479e..1488bb92f26f 100644 --- a/drivers/mtd/maps/ebony.c +++ b/drivers/mtd/maps/ebony.c | |||
@@ -108,6 +108,7 @@ int __init init_ebony(void) | |||
108 | ARRAY_SIZE(ebony_small_partitions)); | 108 | ARRAY_SIZE(ebony_small_partitions)); |
109 | } else { | 109 | } else { |
110 | printk("map probe failed for flash\n"); | 110 | printk("map probe failed for flash\n"); |
111 | iounmap(ebony_small_map.virt); | ||
111 | return -ENXIO; | 112 | return -ENXIO; |
112 | } | 113 | } |
113 | 114 | ||
@@ -117,6 +118,7 @@ int __init init_ebony(void) | |||
117 | 118 | ||
118 | if (!ebony_large_map.virt) { | 119 | if (!ebony_large_map.virt) { |
119 | printk("Failed to ioremap flash\n"); | 120 | printk("Failed to ioremap flash\n"); |
121 | iounmap(ebony_small_map.virt); | ||
120 | return -EIO; | 122 | return -EIO; |
121 | } | 123 | } |
122 | 124 | ||
@@ -129,6 +131,8 @@ int __init init_ebony(void) | |||
129 | ARRAY_SIZE(ebony_large_partitions)); | 131 | ARRAY_SIZE(ebony_large_partitions)); |
130 | } else { | 132 | } else { |
131 | printk("map probe failed for flash\n"); | 133 | printk("map probe failed for flash\n"); |
134 | iounmap(ebony_small_map.virt); | ||
135 | iounmap(ebony_large_map.virt); | ||
132 | return -ENXIO; | 136 | return -ENXIO; |
133 | } | 137 | } |
134 | 138 | ||
diff --git a/drivers/mtd/maps/fortunet.c b/drivers/mtd/maps/fortunet.c index c6bf4e1219ef..7c50c271651c 100644 --- a/drivers/mtd/maps/fortunet.c +++ b/drivers/mtd/maps/fortunet.c | |||
@@ -218,8 +218,11 @@ int __init init_fortunet(void) | |||
218 | map_regions[ix].map_info.size); | 218 | map_regions[ix].map_info.size); |
219 | if(!map_regions[ix].map_info.virt) | 219 | if(!map_regions[ix].map_info.virt) |
220 | { | 220 | { |
221 | int j = 0; | ||
221 | printk(MTD_FORTUNET_PK "%s flash failed to ioremap!\n", | 222 | printk(MTD_FORTUNET_PK "%s flash failed to ioremap!\n", |
222 | map_regions[ix].map_info.name); | 223 | map_regions[ix].map_info.name); |
224 | for (j = 0 ; j < ix; j++) | ||
225 | iounmap(map_regions[j].map_info.virt); | ||
223 | return -ENXIO; | 226 | return -ENXIO; |
224 | } | 227 | } |
225 | simple_map_init(&map_regions[ix].map_info); | 228 | simple_map_init(&map_regions[ix].map_info); |
diff --git a/drivers/mtd/maps/lasat.c b/drivers/mtd/maps/lasat.c index 1c13d2dc0cdf..e34376321050 100644 --- a/drivers/mtd/maps/lasat.c +++ b/drivers/mtd/maps/lasat.c | |||
@@ -79,6 +79,7 @@ static int __init init_lasat(void) | |||
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | 81 | ||
82 | iounmap(lasat_map.virt); | ||
82 | return -ENXIO; | 83 | return -ENXIO; |
83 | } | 84 | } |
84 | 85 | ||
@@ -89,6 +90,7 @@ static void __exit cleanup_lasat(void) | |||
89 | map_destroy(lasat_mtd); | 90 | map_destroy(lasat_mtd); |
90 | } | 91 | } |
91 | if (lasat_map.virt) { | 92 | if (lasat_map.virt) { |
93 | iounmap(lasat_map.virt); | ||
92 | lasat_map.virt = 0; | 94 | lasat_map.virt = 0; |
93 | } | 95 | } |
94 | } | 96 | } |
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c index 0994b5b2e331..198e840ff6db 100644 --- a/drivers/mtd/maps/nettel.c +++ b/drivers/mtd/maps/nettel.c | |||
@@ -277,6 +277,7 @@ int __init nettel_init(void) | |||
277 | nettel_amd_map.virt = ioremap_nocache(amdaddr, maxsize); | 277 | nettel_amd_map.virt = ioremap_nocache(amdaddr, maxsize); |
278 | if (!nettel_amd_map.virt) { | 278 | if (!nettel_amd_map.virt) { |
279 | printk("SNAPGEAR: failed to ioremap() BOOTCS\n"); | 279 | printk("SNAPGEAR: failed to ioremap() BOOTCS\n"); |
280 | iounmap(nettel_mmcrp); | ||
280 | return(-EIO); | 281 | return(-EIO); |
281 | } | 282 | } |
282 | simple_map_init(&nettel_amd_map); | 283 | simple_map_init(&nettel_amd_map); |
@@ -337,7 +338,8 @@ int __init nettel_init(void) | |||
337 | nettel_amd_map.virt = NULL; | 338 | nettel_amd_map.virt = NULL; |
338 | #else | 339 | #else |
339 | /* Only AMD flash supported */ | 340 | /* Only AMD flash supported */ |
340 | return(-ENXIO); | 341 | rc = -ENXIO; |
342 | goto out_unmap2; | ||
341 | #endif | 343 | #endif |
342 | } | 344 | } |
343 | 345 | ||
@@ -361,14 +363,15 @@ int __init nettel_init(void) | |||
361 | nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize); | 363 | nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize); |
362 | if (!nettel_intel_map.virt) { | 364 | if (!nettel_intel_map.virt) { |
363 | printk("SNAPGEAR: failed to ioremap() ROMCS1\n"); | 365 | printk("SNAPGEAR: failed to ioremap() ROMCS1\n"); |
364 | return(-EIO); | 366 | rc = -EIO; |
367 | goto out_unmap2; | ||
365 | } | 368 | } |
366 | simple_map_init(&nettel_intel_map); | 369 | simple_map_init(&nettel_intel_map); |
367 | 370 | ||
368 | intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map); | 371 | intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map); |
369 | if (!intel_mtd) { | 372 | if (!intel_mtd) { |
370 | iounmap(nettel_intel_map.virt); | 373 | rc = -ENXIO; |
371 | return(-ENXIO); | 374 | goto out_unmap1; |
372 | } | 375 | } |
373 | 376 | ||
374 | /* Set PAR to the detected size */ | 377 | /* Set PAR to the detected size */ |
@@ -394,13 +397,14 @@ int __init nettel_init(void) | |||
394 | nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize); | 397 | nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize); |
395 | if (!nettel_intel_map.virt) { | 398 | if (!nettel_intel_map.virt) { |
396 | printk("SNAPGEAR: failed to ioremap() ROMCS1/2\n"); | 399 | printk("SNAPGEAR: failed to ioremap() ROMCS1/2\n"); |
397 | return(-EIO); | 400 | rc = -EIO; |
401 | goto out_unmap2; | ||
398 | } | 402 | } |
399 | 403 | ||
400 | intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map); | 404 | intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map); |
401 | if (! intel_mtd) { | 405 | if (! intel_mtd) { |
402 | iounmap((void *) nettel_intel_map.virt); | 406 | rc = -ENXIO; |
403 | return(-ENXIO); | 407 | goto out_unmap1; |
404 | } | 408 | } |
405 | 409 | ||
406 | intel1size = intel_mtd->size - intel0size; | 410 | intel1size = intel_mtd->size - intel0size; |
@@ -456,6 +460,18 @@ int __init nettel_init(void) | |||
456 | #endif | 460 | #endif |
457 | 461 | ||
458 | return(rc); | 462 | return(rc); |
463 | |||
464 | #ifdef CONFIG_MTD_CFI_INTELEXT | ||
465 | out_unmap1: | ||
466 | iounmap((void *) nettel_intel_map.virt); | ||
467 | #endif | ||
468 | |||
469 | out_unmap2: | ||
470 | iounmap(nettel_mmcrp); | ||
471 | iounmap(nettel_amd_map.virt); | ||
472 | |||
473 | return(rc); | ||
474 | |||
459 | } | 475 | } |
460 | 476 | ||
461 | /****************************************************************************/ | 477 | /****************************************************************************/ |
@@ -469,6 +485,10 @@ void __exit nettel_cleanup(void) | |||
469 | del_mtd_partitions(amd_mtd); | 485 | del_mtd_partitions(amd_mtd); |
470 | map_destroy(amd_mtd); | 486 | map_destroy(amd_mtd); |
471 | } | 487 | } |
488 | if (nettel_mmcrp) { | ||
489 | iounmap(nettel_mmcrp); | ||
490 | nettel_mmcrp = NULL; | ||
491 | } | ||
472 | if (nettel_amd_map.virt) { | 492 | if (nettel_amd_map.virt) { |
473 | iounmap(nettel_amd_map.virt); | 493 | iounmap(nettel_amd_map.virt); |
474 | nettel_amd_map.virt = NULL; | 494 | nettel_amd_map.virt = NULL; |
diff --git a/drivers/mtd/maps/ocotea.c b/drivers/mtd/maps/ocotea.c index 2f07602ba940..5522eac8c980 100644 --- a/drivers/mtd/maps/ocotea.c +++ b/drivers/mtd/maps/ocotea.c | |||
@@ -97,6 +97,7 @@ int __init init_ocotea(void) | |||
97 | ARRAY_SIZE(ocotea_small_partitions)); | 97 | ARRAY_SIZE(ocotea_small_partitions)); |
98 | } else { | 98 | } else { |
99 | printk("map probe failed for flash\n"); | 99 | printk("map probe failed for flash\n"); |
100 | iounmap(ocotea_small_map.virt); | ||
100 | return -ENXIO; | 101 | return -ENXIO; |
101 | } | 102 | } |
102 | 103 | ||
@@ -106,6 +107,7 @@ int __init init_ocotea(void) | |||
106 | 107 | ||
107 | if (!ocotea_large_map.virt) { | 108 | if (!ocotea_large_map.virt) { |
108 | printk("Failed to ioremap flash\n"); | 109 | printk("Failed to ioremap flash\n"); |
110 | iounmap(ocotea_small_map.virt); | ||
109 | return -EIO; | 111 | return -EIO; |
110 | } | 112 | } |
111 | 113 | ||
@@ -118,6 +120,8 @@ int __init init_ocotea(void) | |||
118 | ARRAY_SIZE(ocotea_large_partitions)); | 120 | ARRAY_SIZE(ocotea_large_partitions)); |
119 | } else { | 121 | } else { |
120 | printk("map probe failed for flash\n"); | 122 | printk("map probe failed for flash\n"); |
123 | iounmap(ocotea_small_map.virt); | ||
124 | iounmap(ocotea_large_map.virt); | ||
121 | return -ENXIO; | 125 | return -ENXIO; |
122 | } | 126 | } |
123 | 127 | ||
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index c861134cbc48..995347b1beba 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -602,6 +602,10 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
602 | ret = pcmcia_request_configuration(link, &link->conf); | 602 | ret = pcmcia_request_configuration(link, &link->conf); |
603 | if(ret != CS_SUCCESS) { | 603 | if(ret != CS_SUCCESS) { |
604 | cs_error(link, RequestConfiguration, ret); | 604 | cs_error(link, RequestConfiguration, ret); |
605 | if (dev->win_base) { | ||
606 | iounmap(dev->win_base); | ||
607 | dev->win_base = NULL; | ||
608 | } | ||
605 | return -ENODEV; | 609 | return -ENODEV; |
606 | } | 610 | } |
607 | 611 | ||
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; | |||
126 | 126 | ||
127 | int __init init_redwood_flash(void) | 127 | int __init init_redwood_flash(void) |
128 | { | 128 | { |
129 | int err = 0; | ||
130 | |||
129 | printk(KERN_NOTICE "redwood: flash mapping: %x at %x\n", | 131 | printk(KERN_NOTICE "redwood: flash mapping: %x at %x\n", |
130 | WINDOW_SIZE, WINDOW_ADDR); | 132 | WINDOW_SIZE, WINDOW_ADDR); |
131 | 133 | ||
@@ -141,11 +143,18 @@ int __init init_redwood_flash(void) | |||
141 | 143 | ||
142 | if (redwood_mtd) { | 144 | if (redwood_mtd) { |
143 | redwood_mtd->owner = THIS_MODULE; | 145 | redwood_mtd->owner = THIS_MODULE; |
144 | return add_mtd_partitions(redwood_mtd, | 146 | err = add_mtd_partitions(redwood_mtd, |
145 | redwood_flash_partitions, | 147 | redwood_flash_partitions, |
146 | NUM_REDWOOD_FLASH_PARTITIONS); | 148 | NUM_REDWOOD_FLASH_PARTITIONS); |
149 | if (err) { | ||
150 | printk("init_redwood_flash: add_mtd_partitions failed\n"); | ||
151 | iounmap(redwood_flash_map.virt); | ||
152 | } | ||
153 | return err; | ||
154 | |||
147 | } | 155 | } |
148 | 156 | ||
157 | iounmap(redwood_flash_map.virt); | ||
149 | return -ENXIO; | 158 | return -ENXIO; |
150 | } | 159 | } |
151 | 160 | ||
diff --git a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c index 7d0fcf8f4f33..b8c1331b7a04 100644 --- a/drivers/mtd/maps/sbc8240.c +++ b/drivers/mtd/maps/sbc8240.c | |||
@@ -156,7 +156,7 @@ int __init init_sbc8240_mtd (void) | |||
156 | }; | 156 | }; |
157 | 157 | ||
158 | int devicesfound = 0; | 158 | int devicesfound = 0; |
159 | int i; | 159 | int i,j; |
160 | 160 | ||
161 | for (i = 0; i < NUM_FLASH_BANKS; i++) { | 161 | for (i = 0; i < NUM_FLASH_BANKS; i++) { |
162 | printk (KERN_NOTICE MSG_PREFIX | 162 | printk (KERN_NOTICE MSG_PREFIX |
@@ -166,6 +166,10 @@ int __init init_sbc8240_mtd (void) | |||
166 | (unsigned long) ioremap (pt[i].addr, pt[i].size); | 166 | (unsigned long) ioremap (pt[i].addr, pt[i].size); |
167 | if (!sbc8240_map[i].map_priv_1) { | 167 | if (!sbc8240_map[i].map_priv_1) { |
168 | printk (MSG_PREFIX "failed to ioremap\n"); | 168 | printk (MSG_PREFIX "failed to ioremap\n"); |
169 | for (j = 0; j < i; j++) { | ||
170 | iounmap((void *) sbc8240_map[j].map_priv_1); | ||
171 | sbc8240_map[j].map_priv_1 = 0; | ||
172 | } | ||
169 | return -EIO; | 173 | return -EIO; |
170 | } | 174 | } |
171 | simple_map_init(&sbc8240_mtd[i]); | 175 | simple_map_init(&sbc8240_mtd[i]); |
@@ -175,6 +179,11 @@ int __init init_sbc8240_mtd (void) | |||
175 | if (sbc8240_mtd[i]) { | 179 | if (sbc8240_mtd[i]) { |
176 | sbc8240_mtd[i]->module = THIS_MODULE; | 180 | sbc8240_mtd[i]->module = THIS_MODULE; |
177 | devicesfound++; | 181 | devicesfound++; |
182 | } else { | ||
183 | if (sbc8240_map[i].map_priv_1) { | ||
184 | iounmap((void *) sbc8240_map[i].map_priv_1); | ||
185 | sbc8240_map[i].map_priv_1 = 0; | ||
186 | } | ||
178 | } | 187 | } |
179 | } | 188 | } |
180 | 189 | ||
diff --git a/drivers/mtd/maps/walnut.c b/drivers/mtd/maps/walnut.c index ec80eec376bf..ca932122fb64 100644 --- a/drivers/mtd/maps/walnut.c +++ b/drivers/mtd/maps/walnut.c | |||
@@ -68,6 +68,7 @@ int __init init_walnut(void) | |||
68 | 68 | ||
69 | if (WALNUT_FLASH_ONBD_N(fpga_brds1)) { | 69 | if (WALNUT_FLASH_ONBD_N(fpga_brds1)) { |
70 | printk("The on-board flash is disabled (U79 sw 5)!"); | 70 | printk("The on-board flash is disabled (U79 sw 5)!"); |
71 | iounmap(fpga_status_adr); | ||
71 | return -EIO; | 72 | return -EIO; |
72 | } | 73 | } |
73 | if (WALNUT_FLASH_SRAM_SEL(fpga_brds1)) | 74 | if (WALNUT_FLASH_SRAM_SEL(fpga_brds1)) |
@@ -81,6 +82,7 @@ int __init init_walnut(void) | |||
81 | 82 | ||
82 | if (!walnut_map.virt) { | 83 | if (!walnut_map.virt) { |
83 | printk("Failed to ioremap flash.\n"); | 84 | printk("Failed to ioremap flash.\n"); |
85 | iounmap(fpga_status_adr); | ||
84 | return -EIO; | 86 | return -EIO; |
85 | } | 87 | } |
86 | 88 | ||
@@ -93,9 +95,11 @@ int __init init_walnut(void) | |||
93 | ARRAY_SIZE(walnut_partitions)); | 95 | ARRAY_SIZE(walnut_partitions)); |
94 | } else { | 96 | } else { |
95 | printk("map probe failed for flash\n"); | 97 | printk("map probe failed for flash\n"); |
98 | iounmap(fpga_status_adr); | ||
96 | return -ENXIO; | 99 | return -ENXIO; |
97 | } | 100 | } |
98 | 101 | ||
102 | iounmap(fpga_status_adr); | ||
99 | return 0; | 103 | return 0; |
100 | } | 104 | } |
101 | 105 | ||
diff --git a/drivers/mtd/nand/edb7312.c b/drivers/mtd/nand/edb7312.c index 516c0e5e564c..12017f3c6bd6 100644 --- a/drivers/mtd/nand/edb7312.c +++ b/drivers/mtd/nand/edb7312.c | |||
@@ -198,6 +198,9 @@ static void __exit ep7312_cleanup(void) | |||
198 | /* Release resources, unregister device */ | 198 | /* Release resources, unregister device */ |
199 | nand_release(ap7312_mtd); | 199 | nand_release(ap7312_mtd); |
200 | 200 | ||
201 | /* Release io resource */ | ||
202 | iounmap((void *)this->IO_ADDR_R); | ||
203 | |||
201 | /* Free the MTD device structure */ | 204 | /* Free the MTD device structure */ |
202 | kfree(ep7312_mtd); | 205 | kfree(ep7312_mtd); |
203 | } | 206 | } |
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 |
diff --git a/include/linux/utsrelease.h b/include/linux/utsrelease.h new file mode 100644 index 000000000000..7fe1de0ad4c1 --- /dev/null +++ b/include/linux/utsrelease.h | |||
@@ -0,0 +1 @@ | |||
#define UTS_RELEASE "2.6.18" | |||