Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34142
b: refs/heads/master
c: 25f0c65
h: refs/heads/master
v: v3
  • Loading branch information
Amol Lad authored and David Woodhouse committed Sep 22, 2006
1 parent f804920 commit 1d61d03
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dd8e9ed6ed544e2b924429d29cd2a6b55590109b
refs/heads/master: 25f0c659fe64832d8ee06aa623fffaad708dcf8b
14 changes: 12 additions & 2 deletions trunk/drivers/mtd/maps/arctic-mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ static struct mtd_partition arctic_partitions[PARTITIONS] = {
static int __init
init_arctic_mtd(void)
{
int err = 0;

printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);

arctic_mtd_map.virt = ioremap(PADDR, SIZE);
Expand All @@ -109,12 +111,20 @@ init_arctic_mtd(void)
printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
arctic_mtd = do_map_probe("cfi_probe", &arctic_mtd_map);

if (!arctic_mtd)
if (!arctic_mtd) {
iounmap((void *) arctic_mtd_map.virt);
return -ENXIO;
}

arctic_mtd->owner = THIS_MODULE;

return add_mtd_partitions(arctic_mtd, arctic_partitions, PARTITIONS);
err = add_mtd_partitions(arctic_mtd, arctic_partitions, PARTITIONS);
if (err) {
printk("%s: add_mtd_partitions failed\n", NAME);
iounmap((void *) arctic_mtd_map.virt);
}

return err;
}

static void __exit
Expand Down
14 changes: 12 additions & 2 deletions trunk/drivers/mtd/maps/beech-mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ static struct mtd_partition beech_partitions[2] = {
static int __init
init_beech_mtd(void)
{
int err = 0;

printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);

beech_mtd_map.virt = ioremap(PADDR, SIZE);
Expand All @@ -86,12 +88,20 @@ init_beech_mtd(void)
printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map);

if (!beech_mtd)
if (!beech_mtd) {
iounmap((void *) beech_mtd_map.virt);
return -ENXIO;
}

beech_mtd->owner = THIS_MODULE;

return add_mtd_partitions(beech_mtd, beech_partitions, 2);
err = add_mtd_partitions(beech_mtd, beech_partitions, 2);
if (err) {
printk("%s: add_mtd_partitions failed\n", NAME);
iounmap((void *) beech_mtd_map.virt);
}

return err;
}

static void __exit
Expand Down
18 changes: 16 additions & 2 deletions trunk/drivers/mtd/maps/cstm_mips_ixx.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,14 @@ int __init init_cstm_mips_ixx(void)
cstm_mips_ixx_map[i].phys = cstm_mips_ixx_board_desc[i].window_addr;
cstm_mips_ixx_map[i].virt = ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size);
if (!cstm_mips_ixx_map[i].virt) {
int j = 0;
printk(KERN_WARNING "Failed to ioremap\n");
for (j = 0; j < i; j++) {
if (cstm_mips_ixx_map[j].virt) {
iounmap((void *)cstm_mips_ixx_map[j].virt);
cstm_mips_ixx_map[j].virt = 0;
}
}
return -EIO;
}
cstm_mips_ixx_map[i].name = cstm_mips_ixx_board_desc[i].name;
Expand Down Expand Up @@ -204,8 +211,15 @@ int __init init_cstm_mips_ixx(void)
cstm_mips_ixx_map[i].map_priv_2 = (unsigned long)mymtd;
add_mtd_partitions(mymtd, parts, cstm_mips_ixx_board_desc[i].num_partitions);
}
else
return -ENXIO;
else {
for (i = 0; i < PHYSMAP_NUMBER; i++) {
if (cstm_mips_ixx_map[i].virt) {
iounmap((void *)cstm_mips_ixx_map[i].virt);
cstm_mips_ixx_map[i].virt = 0;
}
}
return -ENXIO;
}
}
return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/mtd/maps/ebony.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ int __init init_ebony(void)
ARRAY_SIZE(ebony_small_partitions));
} else {
printk("map probe failed for flash\n");
iounmap(ebony_small_map.virt);
return -ENXIO;
}

Expand All @@ -117,6 +118,7 @@ int __init init_ebony(void)

if (!ebony_large_map.virt) {
printk("Failed to ioremap flash\n");
iounmap(ebony_small_map.virt);
return -EIO;
}

Expand All @@ -129,6 +131,8 @@ int __init init_ebony(void)
ARRAY_SIZE(ebony_large_partitions));
} else {
printk("map probe failed for flash\n");
iounmap(ebony_small_map.virt);
iounmap(ebony_large_map.virt);
return -ENXIO;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/mtd/maps/fortunet.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ int __init init_fortunet(void)
map_regions[ix].map_info.size);
if(!map_regions[ix].map_info.virt)
{
int j = 0;
printk(MTD_FORTUNET_PK "%s flash failed to ioremap!\n",
map_regions[ix].map_info.name);
for (j = 0 ; j < ix; j++)
iounmap(map_regions[j].map_info.virt);
return -ENXIO;
}
simple_map_init(&map_regions[ix].map_info);
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/mtd/maps/lasat.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static int __init init_lasat(void)
return 0;
}

iounmap(lasat_map.virt);
return -ENXIO;
}

Expand All @@ -89,6 +90,7 @@ static void __exit cleanup_lasat(void)
map_destroy(lasat_mtd);
}
if (lasat_map.virt) {
iounmap(lasat_map.virt);
lasat_map.virt = 0;
}
}
Expand Down
34 changes: 27 additions & 7 deletions trunk/drivers/mtd/maps/nettel.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ int __init nettel_init(void)
nettel_amd_map.virt = ioremap_nocache(amdaddr, maxsize);
if (!nettel_amd_map.virt) {
printk("SNAPGEAR: failed to ioremap() BOOTCS\n");
iounmap(nettel_mmcrp);
return(-EIO);
}
simple_map_init(&nettel_amd_map);
Expand Down Expand Up @@ -337,7 +338,8 @@ int __init nettel_init(void)
nettel_amd_map.virt = NULL;
#else
/* Only AMD flash supported */
return(-ENXIO);
rc = -ENXIO;
goto out_unmap2;
#endif
}

Expand All @@ -361,14 +363,15 @@ int __init nettel_init(void)
nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize);
if (!nettel_intel_map.virt) {
printk("SNAPGEAR: failed to ioremap() ROMCS1\n");
return(-EIO);
rc = -EIO;
goto out_unmap2;
}
simple_map_init(&nettel_intel_map);

intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
if (!intel_mtd) {
iounmap(nettel_intel_map.virt);
return(-ENXIO);
rc = -ENXIO;
goto out_unmap1;
}

/* Set PAR to the detected size */
Expand All @@ -394,13 +397,14 @@ int __init nettel_init(void)
nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize);
if (!nettel_intel_map.virt) {
printk("SNAPGEAR: failed to ioremap() ROMCS1/2\n");
return(-EIO);
rc = -EIO;
goto out_unmap2;
}

intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
if (! intel_mtd) {
iounmap((void *) nettel_intel_map.virt);
return(-ENXIO);
rc = -ENXIO;
goto out_unmap1;
}

intel1size = intel_mtd->size - intel0size;
Expand Down Expand Up @@ -456,6 +460,18 @@ int __init nettel_init(void)
#endif

return(rc);

#ifdef CONFIG_MTD_CFI_INTELEXT
out_unmap1:
iounmap((void *) nettel_intel_map.virt);
#endif

out_unmap2:
iounmap(nettel_mmcrp);
iounmap(nettel_amd_map.virt);

return(rc);

}

/****************************************************************************/
Expand All @@ -469,6 +485,10 @@ void __exit nettel_cleanup(void)
del_mtd_partitions(amd_mtd);
map_destroy(amd_mtd);
}
if (nettel_mmcrp) {
iounmap(nettel_mmcrp);
nettel_mmcrp = NULL;
}
if (nettel_amd_map.virt) {
iounmap(nettel_amd_map.virt);
nettel_amd_map.virt = NULL;
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/mtd/maps/ocotea.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ int __init init_ocotea(void)
ARRAY_SIZE(ocotea_small_partitions));
} else {
printk("map probe failed for flash\n");
iounmap(ocotea_small_map.virt);
return -ENXIO;
}

Expand All @@ -106,6 +107,7 @@ int __init init_ocotea(void)

if (!ocotea_large_map.virt) {
printk("Failed to ioremap flash\n");
iounmap(ocotea_small_map.virt);
return -EIO;
}

Expand All @@ -118,6 +120,8 @@ int __init init_ocotea(void)
ARRAY_SIZE(ocotea_large_partitions));
} else {
printk("map probe failed for flash\n");
iounmap(ocotea_small_map.virt);
iounmap(ocotea_large_map.virt);
return -ENXIO;
}

Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/mtd/maps/pcmciamtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,10 @@ static int pcmciamtd_config(struct pcmcia_device *link)
ret = pcmcia_request_configuration(link, &link->conf);
if(ret != CS_SUCCESS) {
cs_error(link, RequestConfiguration, ret);
if (dev->win_base) {
iounmap(dev->win_base);
dev->win_base = NULL;
}
return -ENODEV;
}

Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/mtd/maps/redwood.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}

Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/mtd/maps/sbc8240.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int __init init_sbc8240_mtd (void)
};

int devicesfound = 0;
int i;
int i,j;

for (i = 0; i < NUM_FLASH_BANKS; i++) {
printk (KERN_NOTICE MSG_PREFIX
Expand All @@ -166,6 +166,10 @@ int __init init_sbc8240_mtd (void)
(unsigned long) ioremap (pt[i].addr, pt[i].size);
if (!sbc8240_map[i].map_priv_1) {
printk (MSG_PREFIX "failed to ioremap\n");
for (j = 0; j < i; j++) {
iounmap((void *) sbc8240_map[j].map_priv_1);
sbc8240_map[j].map_priv_1 = 0;
}
return -EIO;
}
simple_map_init(&sbc8240_mtd[i]);
Expand All @@ -175,6 +179,11 @@ int __init init_sbc8240_mtd (void)
if (sbc8240_mtd[i]) {
sbc8240_mtd[i]->module = THIS_MODULE;
devicesfound++;
} else {
if (sbc8240_map[i].map_priv_1) {
iounmap((void *) sbc8240_map[i].map_priv_1);
sbc8240_map[i].map_priv_1 = 0;
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/mtd/maps/walnut.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ int __init init_walnut(void)

if (WALNUT_FLASH_ONBD_N(fpga_brds1)) {
printk("The on-board flash is disabled (U79 sw 5)!");
iounmap(fpga_status_adr);
return -EIO;
}
if (WALNUT_FLASH_SRAM_SEL(fpga_brds1))
Expand All @@ -81,6 +82,7 @@ int __init init_walnut(void)

if (!walnut_map.virt) {
printk("Failed to ioremap flash.\n");
iounmap(fpga_status_adr);
return -EIO;
}

Expand All @@ -93,9 +95,11 @@ int __init init_walnut(void)
ARRAY_SIZE(walnut_partitions));
} else {
printk("map probe failed for flash\n");
iounmap(fpga_status_adr);
return -ENXIO;
}

iounmap(fpga_status_adr);
return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/mtd/nand/edb7312.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ static void __exit ep7312_cleanup(void)
/* Release resources, unregister device */
nand_release(ap7312_mtd);

/* Release io resource */
iounmap((void *)this->IO_ADDR_R);

/* Free the MTD device structure */
kfree(ep7312_mtd);
}
Expand Down
Loading

0 comments on commit 1d61d03

Please sign in to comment.