* [KJ] [PATCH] ioremap balanced with iounmap for drivers/mtd subsystem
@ 2006-09-21 12:54 ` Amol Lad
0 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-09-21 12:54 UTC (permalink / raw)
To: linux-mtd, kernel Janitors
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>
---
I'm not subsribed to linux-mtd so please cc me.
---
drivers/mtd/maps/arctic-mtd.c | 14 ++++++++++++--
drivers/mtd/maps/beech-mtd.c | 14 ++++++++++++--
drivers/mtd/maps/cstm_mips_ixx.c | 18 ++++++++++++++++--
drivers/mtd/maps/ebony.c | 4 ++++
drivers/mtd/maps/fortunet.c | 3 +++
drivers/mtd/maps/lasat.c | 2 ++
drivers/mtd/maps/nettel.c | 34 +++++++++++++++++++++++++++-------
drivers/mtd/maps/ocotea.c | 4 ++++
drivers/mtd/maps/pcmciamtd.c | 4 ++++
drivers/mtd/maps/redwood.c | 11 ++++++++++-
drivers/mtd/maps/sbc8240.c | 11 ++++++++++-
drivers/mtd/maps/walnut.c | 4 ++++
drivers/mtd/nand/edb7312.c | 3 +++
drivers/mtd/nand/ppchameleonevb.c | 7 +++++++
include/linux/utsrelease.h | 1 +
15 files changed, 119 insertions(+), 15 deletions(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/arctic-mtd.c linux-2.6.18/drivers/mtd/maps/arctic-mtd.c
--- linux-2.6.18-orig/drivers/mtd/maps/arctic-mtd.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/arctic-mtd.c 2006-09-21 16:51:44.000000000 +0530
@@ -96,6 +96,8 @@ static struct mtd_partition arctic_parti
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);
@@ -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
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/beech-mtd.c linux-2.6.18/drivers/mtd/maps/beech-mtd.c
--- linux-2.6.18-orig/drivers/mtd/maps/beech-mtd.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/beech-mtd.c 2006-09-21 16:52:39.000000000 +0530
@@ -72,6 +72,8 @@ static struct mtd_partition beech_partit
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);
@@ -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
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/cstm_mips_ixx.c linux-2.6.18/drivers/mtd/maps/cstm_mips_ixx.c
--- linux-2.6.18-orig/drivers/mtd/maps/cstm_mips_ixx.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/cstm_mips_ixx.c 2006-09-21 16:52:39.000000000 +0530
@@ -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;
@@ -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;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/ebony.c linux-2.6.18/drivers/mtd/maps/ebony.c
--- linux-2.6.18-orig/drivers/mtd/maps/ebony.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/ebony.c 2006-09-21 16:52:39.000000000 +0530
@@ -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;
}
@@ -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;
}
@@ -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;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/fortunet.c linux-2.6.18/drivers/mtd/maps/fortunet.c
--- linux-2.6.18-orig/drivers/mtd/maps/fortunet.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/fortunet.c 2006-09-21 16:52:39.000000000 +0530
@@ -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);
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/lasat.c linux-2.6.18/drivers/mtd/maps/lasat.c
--- linux-2.6.18-orig/drivers/mtd/maps/lasat.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/lasat.c 2006-09-21 16:52:39.000000000 +0530
@@ -79,6 +79,7 @@ static int __init init_lasat(void)
return 0;
}
+ iounmap(lasat_map.virt);
return -ENXIO;
}
@@ -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;
}
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/nettel.c linux-2.6.18/drivers/mtd/maps/nettel.c
--- linux-2.6.18-orig/drivers/mtd/maps/nettel.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/nettel.c 2006-09-21 16:55:13.000000000 +0530
@@ -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);
@@ -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
}
@@ -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 */
@@ -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;
@@ -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);
+
}
/****************************************************************************/
@@ -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;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/ocotea.c linux-2.6.18/drivers/mtd/maps/ocotea.c
--- linux-2.6.18-orig/drivers/mtd/maps/ocotea.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/ocotea.c 2006-09-21 16:52:39.000000000 +0530
@@ -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;
}
@@ -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;
}
@@ -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;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/pcmciamtd.c linux-2.6.18/drivers/mtd/maps/pcmciamtd.c
--- linux-2.6.18-orig/drivers/mtd/maps/pcmciamtd.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/pcmciamtd.c 2006-09-21 16:52:39.000000000 +0530
@@ -602,6 +602,10 @@ static int pcmciamtd_config(struct pcmci
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;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/redwood.c linux-2.6.18/drivers/mtd/maps/redwood.c
--- linux-2.6.18-orig/drivers/mtd/maps/redwood.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/redwood.c 2006-09-21 16:52:39.000000000 +0530
@@ -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;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/sbc8240.c linux-2.6.18/drivers/mtd/maps/sbc8240.c
--- linux-2.6.18-orig/drivers/mtd/maps/sbc8240.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/sbc8240.c 2006-09-21 17:17:27.000000000 +0530
@@ -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
@@ -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]);
@@ -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;
+ }
}
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/maps/walnut.c linux-2.6.18/drivers/mtd/maps/walnut.c
--- linux-2.6.18-orig/drivers/mtd/maps/walnut.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/maps/walnut.c 2006-09-21 16:52:39.000000000 +0530
@@ -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))
@@ -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;
}
@@ -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;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/nand/edb7312.c linux-2.6.18/drivers/mtd/nand/edb7312.c
--- linux-2.6.18-orig/drivers/mtd/nand/edb7312.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/nand/edb7312.c 2006-09-21 17:35:56.000000000 +0530
@@ -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);
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/mtd/nand/ppchameleonevb.c linux-2.6.18/drivers/mtd/nand/ppchameleonevb.c
--- linux-2.6.18-orig/drivers/mtd/nand/ppchameleonevb.c 2006-09-21 10:15:35.000000000 +0530
+++ linux-2.6.18/drivers/mtd/nand/ppchameleonevb.c 2006-09-21 16:52:39.000000000 +0530
@@ -276,6 +276,7 @@ static int __init ppchameleonevb_init(vo
/* Scan to find existence of the device (it could not be mounted) */
if (nand_scan(ppchameleon_mtd, 1)) {
iounmap((void *)ppchameleon_fio_base);
+ ppchameleon_fio_base = NULL;
kfree(ppchameleon_mtd);
goto nand_evb_init;
}
@@ -314,6 +315,8 @@ static int __init ppchameleonevb_init(vo
ppchameleonevb_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
if (!ppchameleonevb_mtd) {
printk("Unable to allocate PPChameleonEVB NAND MTD device structure.\n");
+ if (ppchameleon_fio_base)
+ iounmap(ppchameleon_fio_base);
return -ENOMEM;
}
@@ -322,6 +325,8 @@ static int __init ppchameleonevb_init(vo
if (!ppchameleonevb_fio_base) {
printk("ioremap PPChameleonEVB NAND flash failed\n");
kfree(ppchameleonevb_mtd);
+ if (ppchameleon_fio_base)
+ iounmap(ppchameleon_fio_base);
return -EIO;
}
@@ -378,6 +383,8 @@ static int __init ppchameleonevb_init(vo
if (nand_scan(ppchameleonevb_mtd, 1)) {
iounmap((void *)ppchameleonevb_fio_base);
kfree(ppchameleonevb_mtd);
+ if (ppchameleon_fio_base)
+ iounmap(ppchameleon_fio_base);
return -ENXIO;
}
#ifdef CONFIG_MTD_PARTITIONS
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/include/linux/utsrelease.h linux-2.6.18/include/linux/utsrelease.h
--- linux-2.6.18-orig/include/linux/utsrelease.h 1970-01-01 05:30:00.000000000 +0530
+++ linux-2.6.18/include/linux/utsrelease.h 2006-09-21 16:02:59.000000000 +0530
@@ -0,0 +1 @@
+#define UTS_RELEASE "2.6.18"
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* [KJ] [PATCH] ioremap balanced with iounmap for drivers/isdn
2006-09-21 12:54 ` [KJ] " Amol Lad
(?)
@ 2006-09-26 8:29 ` Amol Lad
-1 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-09-26 8:29 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only) with:
- allmodconfig
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
hisax/diva.c | 26 ++++++++++++++++++++++++--
hysdn/boardergo.c | 2 +-
2 files changed, 25 insertions(+), 3 deletions(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/isdn/hisax/diva.c linux-2.6.18/drivers/isdn/hisax/diva.c
--- linux-2.6.18-orig/drivers/isdn/hisax/diva.c 2006-09-21 10:15:33.000000000 +0530
+++ linux-2.6.18/drivers/isdn/hisax/diva.c 2006-09-26 13:24:05.000000000 +0530
@@ -716,8 +716,10 @@ release_io_diva(struct IsdnCardState *cs
*cfg = 0; /* disable INT0/1 */
*cfg = 2; /* reset pending INT0 */
- iounmap((void *)cs->hw.diva.cfg_reg);
- iounmap((void *)cs->hw.diva.pci_cfg);
+ if (cs->hw.diva.cfg_reg)
+ iounmap((void *)cs->hw.diva.cfg_reg);
+ if (cs->hw.diva.pci_cfg)
+ iounmap((void *)cs->hw.diva.pci_cfg);
return;
} else if (cs->subtyp != DIVA_IPAC_ISA) {
del_timer(&cs->hw.diva.tl);
@@ -734,6 +736,23 @@ release_io_diva(struct IsdnCardState *cs
}
static void
+iounmap_diva(struct IsdnCardState *cs)
+{
+ if ((cs->subtyp = DIVA_IPAC_PCI) || (cs->subtyp = DIVA_IPACX_PCI)) {
+ if (cs->hw.diva.cfg_reg) {
+ iounmap((void *)cs->hw.diva.cfg_reg);
+ cs->hw.diva.cfg_reg = 0;
+ }
+ if (cs->hw.diva.pci_cfg) {
+ iounmap((void *)cs->hw.diva.pci_cfg);
+ cs->hw.diva.pci_cfg = 0;
+ }
+ }
+
+ return;
+}
+
+static void
reset_diva(struct IsdnCardState *cs)
{
if (cs->subtyp = DIVA_IPAC_ISA) {
@@ -1069,11 +1088,13 @@ setup_diva(struct IsdnCard *card)
if (!cs->irq) {
printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
+ iounmap_diva(cs);
return(0);
}
if (!cs->hw.diva.cfg_reg) {
printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
+ iounmap_diva(cs);
return(0);
}
cs->irq_flags |= IRQF_SHARED;
@@ -1123,6 +1144,7 @@ ready:
CardType[card->typ],
cs->hw.diva.cfg_reg,
cs->hw.diva.cfg_reg + bytecnt);
+ iounmap_diva(cs);
return (0);
}
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/isdn/hysdn/boardergo.c linux-2.6.18/drivers/isdn/hysdn/boardergo.c
--- linux-2.6.18-orig/drivers/isdn/hysdn/boardergo.c 2006-09-21 10:15:33.000000000 +0530
+++ linux-2.6.18/drivers/isdn/hysdn/boardergo.c 2006-09-26 10:57:25.000000000 +0530
@@ -408,7 +408,7 @@ ergo_releasehardware(hysdn_card * card)
free_irq(card->irq, card); /* release interrupt */
release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */
release_region(card->iobase + PCI9050_USER_IO, 1);
- vfree(card->dpram);
+ iounmap(card->dpram);
card->dpram = NULL; /* release shared mem */
} /* ergo_releasehardware */
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [KJ] [PATCH] ioremap balanced with iounmap for drivers/isdn
2006-09-21 12:54 ` [KJ] " Amol Lad
(?)
(?)
@ 2006-09-26 13:07 ` Karsten Keil
-1 siblings, 0 replies; 25+ messages in thread
From: Karsten Keil @ 2006-09-26 13:07 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only) with:
- allmodconfig
Signed-off-by: Amol Lad <amol@verismonetworks.com>
Acked-by: Karsten keil <kkeil@suse.de>
---
hisax/diva.c | 26 ++++++++++++++++++++++++--
hysdn/boardergo.c | 2 +-
2 files changed, 25 insertions(+), 3 deletions(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/isdn/hisax/diva.c linux-2.6.18/drivers/isdn/hisax/diva.c
--- linux-2.6.18-orig/drivers/isdn/hisax/diva.c 2006-09-21 10:15:33.000000000 +0530
+++ linux-2.6.18/drivers/isdn/hisax/diva.c 2006-09-26 13:24:05.000000000 +0530
@@ -716,8 +716,10 @@ release_io_diva(struct IsdnCardState *cs
*cfg = 0; /* disable INT0/1 */
*cfg = 2; /* reset pending INT0 */
- iounmap((void *)cs->hw.diva.cfg_reg);
- iounmap((void *)cs->hw.diva.pci_cfg);
+ if (cs->hw.diva.cfg_reg)
+ iounmap((void *)cs->hw.diva.cfg_reg);
+ if (cs->hw.diva.pci_cfg)
+ iounmap((void *)cs->hw.diva.pci_cfg);
return;
} else if (cs->subtyp != DIVA_IPAC_ISA) {
del_timer(&cs->hw.diva.tl);
@@ -734,6 +736,23 @@ release_io_diva(struct IsdnCardState *cs
}
static void
+iounmap_diva(struct IsdnCardState *cs)
+{
+ if ((cs->subtyp = DIVA_IPAC_PCI) || (cs->subtyp = DIVA_IPACX_PCI)) {
+ if (cs->hw.diva.cfg_reg) {
+ iounmap((void *)cs->hw.diva.cfg_reg);
+ cs->hw.diva.cfg_reg = 0;
+ }
+ if (cs->hw.diva.pci_cfg) {
+ iounmap((void *)cs->hw.diva.pci_cfg);
+ cs->hw.diva.pci_cfg = 0;
+ }
+ }
+
+ return;
+}
+
+static void
reset_diva(struct IsdnCardState *cs)
{
if (cs->subtyp = DIVA_IPAC_ISA) {
@@ -1069,11 +1088,13 @@ setup_diva(struct IsdnCard *card)
if (!cs->irq) {
printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
+ iounmap_diva(cs);
return(0);
}
if (!cs->hw.diva.cfg_reg) {
printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
+ iounmap_diva(cs);
return(0);
}
cs->irq_flags |= IRQF_SHARED;
@@ -1123,6 +1144,7 @@ ready:
CardType[card->typ],
cs->hw.diva.cfg_reg,
cs->hw.diva.cfg_reg + bytecnt);
+ iounmap_diva(cs);
return (0);
}
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/isdn/hysdn/boardergo.c linux-2.6.18/drivers/isdn/hysdn/boardergo.c
--- linux-2.6.18-orig/drivers/isdn/hysdn/boardergo.c 2006-09-21 10:15:33.000000000 +0530
+++ linux-2.6.18/drivers/isdn/hysdn/boardergo.c 2006-09-26 10:57:25.000000000 +0530
@@ -408,7 +408,7 @@ ergo_releasehardware(hysdn_card * card)
free_irq(card->irq, card); /* release interrupt */
release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */
release_region(card->iobase + PCI9050_USER_IO, 1);
- vfree(card->dpram);
+ iounmap(card->dpram);
card->dpram = NULL; /* release shared mem */
} /* ergo_releasehardware */
--
Karsten Keil
SuSE Labs
ISDN development
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* [KJ] [PATCH] ioremap balanced with iounmap for drivers/parisc
2006-09-21 12:54 ` [KJ] " Amol Lad
` (2 preceding siblings ...)
(?)
@ 2006-09-28 5:54 ` Amol Lad
2006-09-28 12:58 ` [KJ] [parisc-linux] [PATCH] ioremap balanced with iounmap for Kyle McMartin
-1 siblings, 1 reply; 25+ messages in thread
From: Amol Lad @ 2006-09-28 5:54 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only) to make sure the files are compiling without
any warning/error due to new changes
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
dino.c | 4 +++-
eisa.c | 1 +
iosapic.c | 1 +
lba_pci.c | 7 ++++++-
4 files changed, 11 insertions(+), 2 deletions(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/parisc/dino.c linux-2.6.18/drivers/parisc/dino.c
--- linux-2.6.18-orig/drivers/parisc/dino.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/parisc/dino.c 2006-09-28 10:14:07.000000000 +0530
@@ -1007,8 +1007,10 @@ static int __init dino_probe(struct pari
dino_bridge_init(dino_dev, name);
}
- if (dino_common_init(dev, dino_dev, name))
+ if (dino_common_init(dev, dino_dev, name)) {
+ iounmap(dino_dev->hba.base_addr);
return 1;
+ }
dev->dev.platform_data = dino_dev;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/parisc/eisa.c linux-2.6.18/drivers/parisc/eisa.c
--- linux-2.6.18-orig/drivers/parisc/eisa.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/parisc/eisa.c 2006-09-28 10:14:49.000000000 +0530
@@ -381,6 +381,7 @@ static int __devinit eisa_probe(struct p
eisa_dev.root.dma_mask = 0xffffffff; /* wild guess */
if (eisa_root_register (&eisa_dev.root)) {
printk(KERN_ERR "EISA: Failed to register EISA root\n");
+ iounmap(eisa_eeprom_addr);
return -1;
}
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/parisc/iosapic.c linux-2.6.18/drivers/parisc/iosapic.c
--- linux-2.6.18-orig/drivers/parisc/iosapic.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/parisc/iosapic.c 2006-09-28 10:15:30.000000000 +0530
@@ -887,6 +887,7 @@ void *iosapic_register(unsigned long hpa
vip = isi->isi_vector = (struct vector_info *)
kzalloc(sizeof(struct vector_info) * isi->isi_num_vectors, GFP_KERNEL);
if (vip = NULL) {
+ iounmap(isi->addr);
kfree(isi);
return NULL;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/parisc/lba_pci.c linux-2.6.18/drivers/parisc/lba_pci.c
--- linux-2.6.18-orig/drivers/parisc/lba_pci.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.18/drivers/parisc/lba_pci.c 2006-09-28 10:17:56.000000000 +0530
@@ -1574,6 +1574,7 @@ lba_driver_probe(struct parisc_device *d
cfg_ops = &mercury_cfg_ops;
} else {
printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start);
+ iounmap(addr);
return -ENODEV;
}
@@ -1589,6 +1590,7 @@ lba_driver_probe(struct parisc_device *d
lba_dev = kzalloc(sizeof(struct lba_device), GFP_KERNEL);
if (!lba_dev) {
printk(KERN_ERR "lba_init_chip - couldn't alloc lba_device\n");
+ iounmap(addr);
return(1);
}
@@ -1606,8 +1608,11 @@ lba_driver_probe(struct parisc_device *d
pcibios_register_hba(HBA_DATA(lba_dev));
spin_lock_init(&lba_dev->lba_lock);
- if (lba_hw_init(lba_dev))
+ if (lba_hw_init(lba_dev)) {
+ iounmap(lba_dev->hba.base_addr);
+ lba_dev->hba.base_addr = NULL;
return(1);
+ }
/* ---------- Third : setup I/O Port and MMIO resources --------- */
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [KJ] [parisc-linux] [PATCH] ioremap balanced with iounmap for
@ 2006-09-28 12:58 ` Kyle McMartin
2006-09-28 13:14 ` [parisc-linux] [PATCH] ioremap balanced with iounmap for drivers/parisc Matthew Wilcox
2006-09-28 13:14 ` [KJ] [parisc-linux] [PATCH] ioremap balanced with iounmap for Matthew Wilcox
0 siblings, 2 replies; 25+ messages in thread
From: Kyle McMartin @ 2006-09-28 12:58 UTC (permalink / raw)
To: kernel-janitors
On Thu, Sep 28, 2006 at 11:23:34AM +0530, Amol Lad wrote:
> ioremap must be balanced by an iounmap and failing to do so can result
> in a memory leak.
>
Looks ok. Will merge.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [parisc-linux] [PATCH] ioremap balanced with iounmap for drivers/parisc
2006-09-28 12:58 ` [KJ] [parisc-linux] [PATCH] ioremap balanced with iounmap for Kyle McMartin
@ 2006-09-28 13:14 ` Matthew Wilcox
2006-09-28 13:14 ` [KJ] [parisc-linux] [PATCH] ioremap balanced with iounmap for Matthew Wilcox
1 sibling, 0 replies; 25+ messages in thread
From: Matthew Wilcox @ 2006-09-28 13:14 UTC (permalink / raw)
To: Kyle McMartin; +Cc: kernel Janitors, Amol Lad, parisc-linux
On Thu, Sep 28, 2006 at 08:58:15AM -0400, Kyle McMartin wrote:
> On Thu, Sep 28, 2006 at 11:23:34AM +0530, Amol Lad wrote:
> > ioremap must be balanced by an iounmap and failing to do so can result
> > in a memory leak.
> >
>
> Looks ok. Will merge.
Actually, it shows some areas we need to do better. It's an
improvement, but look at, eg, the error returns from elroy.
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [KJ] [parisc-linux] [PATCH] ioremap balanced with iounmap for
2006-09-28 12:58 ` [KJ] [parisc-linux] [PATCH] ioremap balanced with iounmap for Kyle McMartin
2006-09-28 13:14 ` [parisc-linux] [PATCH] ioremap balanced with iounmap for drivers/parisc Matthew Wilcox
@ 2006-09-28 13:14 ` Matthew Wilcox
2006-09-28 13:20 ` [parisc-linux] [PATCH] ioremap balanced with iounmap for drivers/parisc Kyle McMartin
1 sibling, 1 reply; 25+ messages in thread
From: Matthew Wilcox @ 2006-09-28 13:14 UTC (permalink / raw)
To: kernel-janitors
On Thu, Sep 28, 2006 at 08:58:15AM -0400, Kyle McMartin wrote:
> On Thu, Sep 28, 2006 at 11:23:34AM +0530, Amol Lad wrote:
> > ioremap must be balanced by an iounmap and failing to do so can result
> > in a memory leak.
> >
>
> Looks ok. Will merge.
Actually, it shows some areas we need to do better. It's an
improvement, but look at, eg, the error returns from elroy.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread
* [KJ] [PATCH] ioremap balanced with iounmap for drivers/pci/hotplug
2006-09-21 12:54 ` [KJ] " Amol Lad
` (3 preceding siblings ...)
(?)
@ 2006-09-28 6:27 ` Amol Lad
-1 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-09-28 6:27 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only) with:
- allmodconfig
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
shpchp_hpc.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/pci/hotplug/shpchp_hpc.c linux-2.6.18/drivers/pci/hotplug/shpchp_hpc.c
--- linux-2.6.18-orig/drivers/pci/hotplug/shpchp_hpc.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/pci/hotplug/shpchp_hpc.c 2006-09-28 11:32:02.000000000 +0530
@@ -1282,8 +1282,11 @@ int shpc_init(struct controller * ctrl,
*/
if (atomic_add_return(1, &shpchp_num_controllers) = 1) {
shpchp_wq = create_singlethread_workqueue("shpchpd");
- if (!shpchp_wq)
+ if (!shpchp_wq) {
+ iounmap(php_ctlr->creg);
+ php_ctlr->creg = NULL;
return -ENOMEM;
+ }
}
/*
@@ -1313,6 +1316,8 @@ int shpc_init(struct controller * ctrl,
/* We end up here for the many possible ways to fail this API. */
abort_free_ctlr:
+ if (php_ctlr->creg)
+ iounmap(php_ctlr->creg);
kfree(php_ctlr);
abort:
DBG_LEAVE_ROUTINE
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* [KJ] [PATCH] ioremap balanced with iounmap for drivers/pcmcia
2006-09-21 12:54 ` [KJ] " Amol Lad
` (4 preceding siblings ...)
(?)
@ 2006-09-28 13:09 ` Amol Lad
-1 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-09-28 13:09 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only) to make sure the files are compiling without
any warning/error due to new changes
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
Please CC me. I'm not on linux-pcmcia
---
at91_cf.c | 3 ++-
au1000_generic.c | 10 ++++++++++
m8xx_pcmcia.c | 12 ++++++++----
omap_cf.c | 3 ++-
4 files changed, 22 insertions(+), 6 deletions(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/pcmcia/at91_cf.c linux-2.6.18/drivers/pcmcia/at91_cf.c
--- linux-2.6.18-orig/drivers/pcmcia/at91_cf.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/pcmcia/at91_cf.c 2006-09-28 17:30:13.000000000 +0530
@@ -316,9 +316,10 @@ static int __init at91_cf_probe(struct p
return 0;
fail2:
- iounmap((void __iomem *) cf->socket.io_offset);
release_mem_region(io->start, io->end + 1 - io->start);
fail1:
+ if (cf->socket.io_offset)
+ iounmap((void __iomem *) cf->socket.io_offset);
if (board->irq_pin)
free_irq(board->irq_pin, cf);
fail0a:
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/pcmcia/au1000_generic.c linux-2.6.18/drivers/pcmcia/au1000_generic.c
--- linux-2.6.18-orig/drivers/pcmcia/au1000_generic.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/pcmcia/au1000_generic.c 2006-09-28 17:45:42.000000000 +0530
@@ -445,6 +445,16 @@ int au1x00_pcmcia_socket_probe(struct de
pcmcia_unregister_socket(&skt->socket);
out_err:
flush_scheduled_work();
+ if (i = 0) {
+ iounmap(skt->virt_io + (u32)mips_io_port_base);
+ skt->virt_io = NULL;
+ }
+#ifndef CONFIG_MIPS_XXS1500
+ else {
+ iounmap(skt->virt_io + (u32)mips_io_port_base);
+ skt->virt_io = NULL;
+ }
+#endif
ops->hw_shutdown(skt);
i--;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/pcmcia/m8xx_pcmcia.c linux-2.6.18/drivers/pcmcia/m8xx_pcmcia.c
--- linux-2.6.18-orig/drivers/pcmcia/m8xx_pcmcia.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/pcmcia/m8xx_pcmcia.c 2006-09-28 17:51:19.000000000 +0530
@@ -427,7 +427,7 @@ static int voltage_set(int slot, int vcc
reg |= BCSR1_PCCVCC1;
break;
default:
- return 1;
+ goto out_unmap;
}
switch(vpp) {
@@ -438,15 +438,15 @@ static int voltage_set(int slot, int vcc
if(vcc = vpp)
reg |= BCSR1_PCCVPP1;
else
- return 1;
+ goto out_unmap;
break;
case 120:
if ((vcc = 33) || (vcc = 50))
reg |= BCSR1_PCCVPP0;
else
- return 1;
+ goto out_unmap;
default:
- return 1;
+ goto out_unmap;
}
/* first, turn off all power */
@@ -457,6 +457,10 @@ static int voltage_set(int slot, int vcc
iounmap(bcsr_io);
return 0;
+
+out_unmap:
+ iounmap(bcsr_io);
+ return 1;
}
#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/pcmcia/omap_cf.c linux-2.6.18/drivers/pcmcia/omap_cf.c
--- linux-2.6.18-orig/drivers/pcmcia/omap_cf.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/pcmcia/omap_cf.c 2006-09-28 17:52:58.000000000 +0530
@@ -306,9 +306,10 @@ static int __init omap_cf_probe(struct d
return 0;
fail2:
- iounmap((void __iomem *) cf->socket.io_offset);
release_mem_region(cf->phys_cf, SZ_8K);
fail1:
+ if (cf->socket.io_offset)
+ iounmap((void __iomem *) cf->socket.io_offset);
free_irq(irq, cf);
fail0:
kfree(cf);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* [KJ] [PATCH] ioremap balanced with iounmap for drivers/video
2006-09-21 12:54 ` [KJ] " Amol Lad
` (5 preceding siblings ...)
(?)
@ 2006-09-29 13:12 ` Amol Lad
-1 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-09-29 13:12 UTC (permalink / raw)
To: kernel-janitors
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/video/Kconfig to make sure that the changed file is
compiling without error/warning
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
S3triofb.c | 7 +++++--
amifb.c | 8 +++++---
atafb.c | 13 ++++++++++++-
aty/atyfb_base.c | 8 ++++++++
cirrusfb.c | 15 +++++++++++++--
console/newport_con.c | 9 ++++++++-
cyberfb.c | 2 ++
ffb.c | 4 ++++
fm2fb.c | 1 +
hpfb.c | 2 ++
macfb.c | 20 ++++++++++++++++++++
offb.c | 3 +++
platinumfb.c | 3 +++
pvr2fb.c | 18 ++++++++++++++++++
retz3fb.c | 4 +++-
stifb.c | 3 +++
tgafb.c | 2 ++
tridentfb.c | 22 +++++++++++++++++-----
vesafb.c | 2 ++
virgefb.c | 17 ++++++++++++++++-
20 files changed, 147 insertions(+), 16 deletions(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/amifb.c linux-2.6.18/drivers/video/amifb.c
--- linux-2.6.18-orig/drivers/video/amifb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/amifb.c 2006-09-29 16:37:46.000000000 +0530
@@ -2407,10 +2407,10 @@ default_chipset:
fb_info.fix.smem_len);
if (!videomemory) {
printk("amifb: WARNING! unable to map videomem cached writethrough\n");
- videomemory = ZTWO_VADDR(fb_info.fix.smem_start);
- }
+ fb_info.screen_base = (char *)ZTWO_VADDR(fb_info.fix.smem_start);
+ } else
+ fb_info.screen_base = (char *)videomemory;
- fb_info.screen_base = (char *)videomemory;
memset(dummysprite, 0, DUMMYSPRITEMEMSIZE);
/*
@@ -2453,6 +2453,8 @@ static void amifb_deinit(void)
{
fb_dealloc_cmap(&fb_info.cmap);
chipfree();
+ if (videomemory)
+ iounmap((void*)videomemory);
release_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120);
custom.dmacon = DMAF_ALL | DMAF_MASTER;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/atafb.c linux-2.6.18/drivers/video/atafb.c
--- linux-2.6.18-orig/drivers/video/atafb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/atafb.c 2006-09-29 17:39:40.000000000 +0530
@@ -2804,8 +2804,19 @@ int __init atafb_init(void)
atafb_set_disp(-1, &fb_info);
do_install_cmap(0, &fb_info);
- if (register_framebuffer(&fb_info) < 0)
+ if (register_framebuffer(&fb_info) < 0) {
+#ifdef ATAFB_EXT
+ if (external_addr) {
+ iounmap(external_addr);
+ external_addr = NULL;
+ }
+ if (external_vgaiobase) {
+ iounmap((void*)external_vgaiobase);
+ external_vgaiobase = 0;
+ }
+#endif
return -EINVAL;
+ }
printk("Determined %dx%d, depth %d\n",
disp.var.xres, disp.var.yres, disp.var.bits_per_pixel);
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/aty/atyfb_base.c linux-2.6.18/drivers/video/aty/atyfb_base.c
--- linux-2.6.18-orig/drivers/video/aty/atyfb_base.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/aty/atyfb_base.c 2006-09-29 17:36:47.000000000 +0530
@@ -3530,6 +3530,10 @@ static int __devinit atyfb_setup_generic
atyfb_setup_generic_fail:
iounmap(par->ati_regbase);
par->ati_regbase = NULL;
+ if (info->screen_base) {
+ iounmap(info->screen_base);
+ info->screen_base = NULL;
+ }
return ret;
}
@@ -3698,6 +3702,10 @@ static int __devinit atyfb_atari_probe(v
}
if (aty_init(info, "ISA bus")) {
+ if (info->screen_base)
+ iounmap(info->screen_base);
+ if (par->ati_regbase)
+ iounmap(par->ati_regbase);
framebuffer_release(info);
/* This is insufficient! kernel_map has added two large chunks!! */
return -ENXIO;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/cirrusfb.c linux-2.6.18/drivers/video/cirrusfb.c
--- linux-2.6.18-orig/drivers/video/cirrusfb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/cirrusfb.c 2006-09-29 17:48:34.000000000 +0530
@@ -2442,7 +2442,10 @@ static int cirrusfb_pci_register (struct
printk ("Cirrus Logic chipset on PCI bus\n");
pci_set_drvdata(pdev, info);
- return cirrusfb_register(cinfo);
+ ret = cirrusfb_register(cinfo);
+ if (ret)
+ iounmap(cinfo->fbmem);
+ return ret;
err_release_legacy:
if (release_io_ports)
@@ -2574,7 +2577,15 @@ static int cirrusfb_zorro_register(struc
printk (KERN_INFO "Cirrus Logic chipset on Zorro bus\n");
zorro_set_drvdata(z, info);
- return cirrusfb_register(cinfo);
+ ret = cirrusfb_register(cinfo);
+ if (ret) {
+ if (btype = BT_PICASSO4) {
+ iounmap(cinfo->fbmem);
+ iounmap(cinfo->regbase - 0x600000);
+ } else if (board_addr > 0x01000000)
+ iounmap(cinfo->fbmem);
+ }
+ return ret;
err_unmap_regbase:
/* Parental advisory: explicit hack */
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/console/newport_con.c linux-2.6.18/drivers/video/console/newport_con.c
--- linux-2.6.18-orig/drivers/video/console/newport_con.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/console/newport_con.c 2006-09-29 17:57:58.000000000 +0530
@@ -323,6 +323,8 @@ static const char *newport_startup(void)
return "SGI Newport";
out_unmap:
+ iounmap((void *)npregs);
+ npregs = NULL;
return NULL;
}
@@ -738,6 +740,7 @@ const struct consw newport_con = {
#ifdef MODULE
static int __init newport_console_init(void)
{
+ int err;
if (!sgi_gfxaddr)
return NULL;
@@ -746,7 +749,11 @@ static int __init newport_console_init(v
npregs = (struct newport_regs *)/* ioremap cannot fail */
ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
- return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
+ err = take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
+ if (err)
+ iounmap((void *)npregs);
+
+ return err;
}
module_init(newport_console_init);
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/cyberfb.c linux-2.6.18/drivers/video/cyberfb.c
--- linux-2.6.18-orig/drivers/video/cyberfb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/cyberfb.c 2006-09-29 16:26:19.000000000 +0530
@@ -1055,6 +1055,8 @@ int __init cyberfb_init(void)
if (register_framebuffer(&fb_info) < 0) {
DPRINTK("EXIT - register_framebuffer failed\n");
+ if (CyberBase)
+ iounmap(CyberBase);
release_mem_region(CyberMem_phys, 0x400000);
release_mem_region(CyberRegs_phys, 0x10000);
return -EINVAL;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/ffb.c linux-2.6.18/drivers/video/ffb.c
--- linux-2.6.18-orig/drivers/video/ffb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/ffb.c 2006-09-29 11:19:09.000000000 +0530
@@ -968,6 +968,8 @@ static int ffb_init_one(struct of_device
if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
printk(KERN_ERR "ffb: Could not allocate color map.\n");
+ of_iounmap(all->par.fbc, sizeof(struct ffb_fbc));
+ of_iounmap(all->par.dac, sizeof(struct ffb_dac));
kfree(all);
return -ENOMEM;
}
@@ -978,6 +980,8 @@ static int ffb_init_one(struct of_device
if (err < 0) {
printk(KERN_ERR "ffb: Could not register framebuffer.\n");
fb_dealloc_cmap(&all->info.cmap);
+ of_iounmap(all->par.fbc, sizeof(struct ffb_fbc));
+ of_iounmap(all->par.dac, sizeof(struct ffb_dac));
kfree(all);
return err;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/fm2fb.c linux-2.6.18/drivers/video/fm2fb.c
--- linux-2.6.18-orig/drivers/video/fm2fb.c 2006-08-24 02:46:33.000000000 +0530
+++ linux-2.6.18/drivers/video/fm2fb.c 2006-09-29 11:20:30.000000000 +0530
@@ -283,6 +283,7 @@ static int __devinit fm2fb_probe(struct
if (register_framebuffer(info) < 0) {
fb_dealloc_cmap(&info->cmap);
+ iounmap(info->screen_base);
framebuffer_release(info);
zorro_release_device(z);
return -EINVAL;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/hpfb.c linux-2.6.18/drivers/video/hpfb.c
--- linux-2.6.18-orig/drivers/video/hpfb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/hpfb.c 2006-09-29 11:30:45.000000000 +0530
@@ -295,6 +295,8 @@ static int __init hpfb_init_one(unsigned
if (register_framebuffer(&fb_info) < 0) {
fb_dealloc_cmap(&fb_info.cmap);
+ iounmap(fb_info.screen_base);
+ fb_info.screen_base = NULL;
return 1;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/macfb.c linux-2.6.18/drivers/video/macfb.c
--- linux-2.6.18-orig/drivers/video/macfb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/macfb.c 2006-09-29 18:14:42.000000000 +0530
@@ -608,6 +608,22 @@ void __init macfb_setup(char *options)
}
}
+static void __init iounmap_macfb(void)
+{
+ if (valkyrie_cmap_regs)
+ iounmap(valkyrie_cmap_regs);
+ if (dafb_cmap_regs)
+ iounmap(dafb_cmap_regs);
+ if (v8_brazil_cmap_regs)
+ iounmap(v8_brazil_cmap_regs);
+ if (rbv_cmap_regs)
+ iounmap(rbv_cmap_regs);
+ if (civic_cmap_regs)
+ iounmap(civic_cmap_regs);
+ if (csc_cmap_regs)
+ iounmap(csc_cmap_regs);
+}
+
static int __init macfb_init(void)
{
int video_cmap_len, video_is_nubus = 0;
@@ -962,6 +978,10 @@ static int __init macfb_init(void)
if (!err)
printk("fb%d: %s frame buffer device\n",
fb_info.node, fb_info.fix.id);
+ else {
+ iounmap(fb_info.screen_base);
+ iounmap_macfb();
+ }
return err;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/offb.c linux-2.6.18/drivers/video/offb.c
--- linux-2.6.18-orig/drivers/video/offb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/offb.c 2006-09-29 12:07:28.000000000 +0530
@@ -392,6 +392,9 @@ static void __init offb_init_fb(const ch
fb_alloc_cmap(&info->cmap, 256, 0);
if (register_framebuffer(info) < 0) {
+ iounmap(par->cmap_adr);
+ par->cmap_adr = NULL;
+ iounmap(info->screen_base);
kfree(info);
release_mem_region(res_start, res_size);
return;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/platinumfb.c linux-2.6.18/drivers/video/platinumfb.c
--- linux-2.6.18-orig/drivers/video/platinumfb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/platinumfb.c 2006-09-29 12:12:17.000000000 +0530
@@ -623,6 +623,9 @@ static int __devinit platinumfb_probe(st
rc = platinum_init_fb(info);
if (rc != 0) {
+ iounmap(pinfo->frame_buffer);
+ iounmap(pinfo->platinum_regs);
+ iounmap(pinfo->cmap_regs);
dev_set_drvdata(&odev->dev, NULL);
framebuffer_release(info);
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/pvr2fb.c linux-2.6.18/drivers/video/pvr2fb.c
--- linux-2.6.18-orig/drivers/video/pvr2fb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/pvr2fb.c 2006-09-29 15:07:50.000000000 +0530
@@ -903,6 +903,15 @@ static int __init pvr2fb_dc_init(void)
static void pvr2fb_dc_exit(void)
{
+ if (fb_info->screen_base) {
+ iounmap(fb_info->screen_base);
+ fb_info->screen_base = NULL;
+ }
+ if (currentpar->mmio_base) {
+ iounmap((void *)currentpar->mmio_base);
+ currentpar->mmio_base = 0;
+ }
+
free_irq(HW_EVENT_VSYNC, 0);
#ifdef CONFIG_SH_DMA
free_dma(pvr2dma);
@@ -944,6 +953,15 @@ static int __devinit pvr2fb_pci_probe(st
static void __devexit pvr2fb_pci_remove(struct pci_dev *pdev)
{
+ if (fb_info->screen_base) {
+ iounmap(fb_info->screen_base);
+ fb_info->screen_base = NULL;
+ }
+ if (currentpar->mmio_base) {
+ iounmap((void *)currentpar->mmio_base);
+ currentpar->mmio_base = 0;
+ }
+
pci_release_regions(pdev);
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/retz3fb.c linux-2.6.18/drivers/video/retz3fb.c
--- linux-2.6.18-orig/drivers/video/retz3fb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/retz3fb.c 2006-09-29 16:06:39.000000000 +0530
@@ -1423,8 +1423,10 @@ int __init retz3fb_init(void)
do_install_cmap(0, fb_info);
- if (register_framebuffer(fb_info) < 0)
+ if (register_framebuffer(fb_info) < 0) {
+ iounmap(zinfo->base);
return -EINVAL;
+ }
printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of "
"video memory\n", fb_info->node,
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/S3triofb.c linux-2.6.18/drivers/video/S3triofb.c
--- linux-2.6.18-orig/drivers/video/S3triofb.c 2006-09-21 10:15:41.000000000 +0530
+++ linux-2.6.18/drivers/video/S3triofb.c 2006-09-29 18:22:25.000000000 +0530
@@ -535,8 +535,11 @@ static void __init s3triofb_of_init(stru
#endif
fb_info.flags = FBINFO_FLAG_DEFAULT;
- if (register_framebuffer(&fb_info) < 0)
- return;
+ if (register_framebuffer(&fb_info) < 0) {
+ iounmap(fb_info.screen_base);
+ fb_info.screen_base = NULL;
+ return;
+ }
printk("fb%d: S3 Trio frame buffer device on %s\n",
fb_info.node, dp->full_name);
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/stifb.c linux-2.6.18/drivers/video/stifb.c
--- linux-2.6.18-orig/drivers/video/stifb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/stifb.c 2006-09-29 12:42:57.000000000 +0530
@@ -1291,6 +1291,7 @@ out_err3:
out_err2:
release_mem_region(fix->smem_start, fix->smem_len);
out_err1:
+ iounmap(info->screen_base);
fb_dealloc_cmap(&info->cmap);
out_err0:
kfree(fb);
@@ -1364,6 +1365,8 @@ stifb_cleanup(void)
unregister_framebuffer(sti->info);
release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
release_mem_region(info->fix.smem_start, info->fix.smem_len);
+ if (info->screen_base)
+ iounmap(info->screen_base);
fb_dealloc_cmap(&info->cmap);
kfree(info);
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/tgafb.c linux-2.6.18/drivers/video/tgafb.c
--- linux-2.6.18-orig/drivers/video/tgafb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/tgafb.c 2006-09-29 12:46:01.000000000 +0530
@@ -1473,6 +1473,8 @@ tgafb_pci_register(struct pci_dev *pdev,
return 0;
err1:
+ if (mem_base)
+ iounmap(mem_base);
release_mem_region(bar0_start, bar0_len);
err0:
kfree(all);
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/tridentfb.c linux-2.6.18/drivers/video/tridentfb.c
--- linux-2.6.18-orig/drivers/video/tridentfb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/tridentfb.c 2006-09-29 16:46:59.000000000 +0530
@@ -1130,7 +1130,8 @@ static int __devinit trident_pci_probe(s
if (!request_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len, "tridentfb")) {
debug("request_mem_region failed!\n");
- return -1;
+ err = -1;
+ goto out_unmap;
}
fb_info.screen_base = ioremap_nocache(tridentfb_fix.smem_start,
@@ -1139,7 +1140,8 @@ static int __devinit trident_pci_probe(s
if (!fb_info.screen_base) {
release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
debug("ioremap failed\n");
- return -1;
+ err = -1;
+ goto out_unmap;
}
output("%s board found\n", pci_name(dev));
@@ -1162,8 +1164,10 @@ static int __devinit trident_pci_probe(s
#endif
fb_info.pseudo_palette = pseudo_pal;
- if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp))
- return -EINVAL;
+ if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp)) {
+ err = -EINVAL;
+ goto out_unmap;
+ }
fb_alloc_cmap(&fb_info.cmap,256,0);
if (defaultaccel && acc)
default_var.accel_flags |= FB_ACCELF_TEXT;
@@ -1174,12 +1178,20 @@ static int __devinit trident_pci_probe(s
fb_info.device = &dev->dev;
if (register_framebuffer(&fb_info) < 0) {
printk(KERN_ERR "tridentfb: could not register Trident framebuffer\n");
- return -EINVAL;
+ err = -EINVAL;
+ goto out_unmap;
}
output("fb%d: %s frame buffer device %dx%d-%dbpp\n",
fb_info.node, fb_info.fix.id,default_var.xres,
default_var.yres,default_var.bits_per_pixel);
return 0;
+
+out_unmap:
+ if (default_par.io_virt)
+ iounmap(default_par.io_virt);
+ if (fb_info.screen_base)
+ iounmap(fb_info.screen_base);
+ return err;
}
static void __devexit trident_pci_remove(struct pci_dev * dev)
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/vesafb.c linux-2.6.18/drivers/video/vesafb.c
--- linux-2.6.18-orig/drivers/video/vesafb.c 2006-09-21 10:15:42.000000000 +0530
+++ linux-2.6.18/drivers/video/vesafb.c 2006-09-29 14:19:03.000000000 +0530
@@ -456,6 +456,8 @@ static int __init vesafb_probe(struct pl
info->node, info->fix.id);
return 0;
err:
+ if (info->screen_base)
+ iounmap(info->screen_base);
framebuffer_release(info);
release_mem_region(vesafb_fix.smem_start, size_total);
return err;
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/virgefb.c linux-2.6.18/drivers/video/virgefb.c
--- linux-2.6.18-orig/drivers/video/virgefb.c 2006-09-29 15:18:24.000000000 +0530
+++ linux-2.6.18/drivers/video/virgefb.c 2006-09-29 15:20:34.000000000 +0530
@@ -1799,7 +1799,7 @@ int __init virgefb_init(void)
#warning release resources
printk(KERN_ERR "virgefb.c: register_framebuffer failed\n");
DPRINTK("EXIT\n");
- return -EINVAL;
+ goto out_unmap;
}
printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n",
@@ -1809,6 +1809,21 @@ int __init virgefb_init(void)
DPRINTK("EXIT\n");
return 0;
+
+out_unmap:
+ if (board_addr >= 0x01000000) {
+ if (v_ram)
+ iounmap((void*)v_ram);
+ if (vgaio_regs)
+ iounmap(vgaio_regs);
+ if (mmio_regs)
+ iounmap(mmio_regs);
+ if (vcode_switch_base)
+ iounmap((void*)vcode_switch_base);
+ v_ram = vcode_switch_base = 0;
+ vgaio_regs = mmio_regs = NULL;
+ }
+ return -EINVAL;
}
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [KJ] [PATCH] ioremap balanced with iounmap for drivers/video
2006-09-21 12:54 ` [KJ] " Amol Lad
` (6 preceding siblings ...)
(?)
@ 2006-09-29 14:43 ` Mauro Carvalho Chehab
-1 siblings, 0 replies; 25+ messages in thread
From: Mauro Carvalho Chehab @ 2006-09-29 14:43 UTC (permalink / raw)
To: kernel-janitors
Amol,
We are not responsible for video adapter drivers, but, instead, for
video capture adapters. I suggest you to send your patch to LKML, where
all kernel maintainers are (linux-kernel@vger.kernel.org).
Cheers,
Mauro.
Em Sex, 2006-09-29 às 18:30 +0530, Amol Lad escreveu:
> 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/video/Kconfig to make sure that the changed file is
> compiling without error/warning
>
> Signed-off-by: Amol Lad <amol@verismonetworks.com>
> ---
> S3triofb.c | 7 +++++--
> amifb.c | 8 +++++---
> atafb.c | 13 ++++++++++++-
> aty/atyfb_base.c | 8 ++++++++
> cirrusfb.c | 15 +++++++++++++--
> console/newport_con.c | 9 ++++++++-
> cyberfb.c | 2 ++
> ffb.c | 4 ++++
> fm2fb.c | 1 +
> hpfb.c | 2 ++
> macfb.c | 20 ++++++++++++++++++++
> offb.c | 3 +++
> platinumfb.c | 3 +++
> pvr2fb.c | 18 ++++++++++++++++++
> retz3fb.c | 4 +++-
> stifb.c | 3 +++
> tgafb.c | 2 ++
> tridentfb.c | 22 +++++++++++++++++-----
> vesafb.c | 2 ++
> virgefb.c | 17 ++++++++++++++++-
> 20 files changed, 147 insertions(+), 16 deletions(-)
> ---
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/amifb.c linux-2.6.18/drivers/video/amifb.c
> --- linux-2.6.18-orig/drivers/video/amifb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/amifb.c 2006-09-29 16:37:46.000000000 +0530
> @@ -2407,10 +2407,10 @@ default_chipset:
> fb_info.fix.smem_len);
> if (!videomemory) {
> printk("amifb: WARNING! unable to map videomem cached writethrough\n");
> - videomemory = ZTWO_VADDR(fb_info.fix.smem_start);
> - }
> + fb_info.screen_base = (char *)ZTWO_VADDR(fb_info.fix.smem_start);
> + } else
> + fb_info.screen_base = (char *)videomemory;
>
> - fb_info.screen_base = (char *)videomemory;
> memset(dummysprite, 0, DUMMYSPRITEMEMSIZE);
>
> /*
> @@ -2453,6 +2453,8 @@ static void amifb_deinit(void)
> {
> fb_dealloc_cmap(&fb_info.cmap);
> chipfree();
> + if (videomemory)
> + iounmap((void*)videomemory);
> release_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120);
> custom.dmacon = DMAF_ALL | DMAF_MASTER;
> }
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/atafb.c linux-2.6.18/drivers/video/atafb.c
> --- linux-2.6.18-orig/drivers/video/atafb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/atafb.c 2006-09-29 17:39:40.000000000 +0530
> @@ -2804,8 +2804,19 @@ int __init atafb_init(void)
> atafb_set_disp(-1, &fb_info);
> do_install_cmap(0, &fb_info);
>
> - if (register_framebuffer(&fb_info) < 0)
> + if (register_framebuffer(&fb_info) < 0) {
> +#ifdef ATAFB_EXT
> + if (external_addr) {
> + iounmap(external_addr);
> + external_addr = NULL;
> + }
> + if (external_vgaiobase) {
> + iounmap((void*)external_vgaiobase);
> + external_vgaiobase = 0;
> + }
> +#endif
> return -EINVAL;
> + }
>
> printk("Determined %dx%d, depth %d\n",
> disp.var.xres, disp.var.yres, disp.var.bits_per_pixel);
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/aty/atyfb_base.c linux-2.6.18/drivers/video/aty/atyfb_base.c
> --- linux-2.6.18-orig/drivers/video/aty/atyfb_base.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/aty/atyfb_base.c 2006-09-29 17:36:47.000000000 +0530
> @@ -3530,6 +3530,10 @@ static int __devinit atyfb_setup_generic
> atyfb_setup_generic_fail:
> iounmap(par->ati_regbase);
> par->ati_regbase = NULL;
> + if (info->screen_base) {
> + iounmap(info->screen_base);
> + info->screen_base = NULL;
> + }
> return ret;
> }
>
> @@ -3698,6 +3702,10 @@ static int __devinit atyfb_atari_probe(v
> }
>
> if (aty_init(info, "ISA bus")) {
> + if (info->screen_base)
> + iounmap(info->screen_base);
> + if (par->ati_regbase)
> + iounmap(par->ati_regbase);
> framebuffer_release(info);
> /* This is insufficient! kernel_map has added two large chunks!! */
> return -ENXIO;
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/cirrusfb.c linux-2.6.18/drivers/video/cirrusfb.c
> --- linux-2.6.18-orig/drivers/video/cirrusfb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/cirrusfb.c 2006-09-29 17:48:34.000000000 +0530
> @@ -2442,7 +2442,10 @@ static int cirrusfb_pci_register (struct
> printk ("Cirrus Logic chipset on PCI bus\n");
> pci_set_drvdata(pdev, info);
>
> - return cirrusfb_register(cinfo);
> + ret = cirrusfb_register(cinfo);
> + if (ret)
> + iounmap(cinfo->fbmem);
> + return ret;
>
> err_release_legacy:
> if (release_io_ports)
> @@ -2574,7 +2577,15 @@ static int cirrusfb_zorro_register(struc
> printk (KERN_INFO "Cirrus Logic chipset on Zorro bus\n");
> zorro_set_drvdata(z, info);
>
> - return cirrusfb_register(cinfo);
> + ret = cirrusfb_register(cinfo);
> + if (ret) {
> + if (btype = BT_PICASSO4) {
> + iounmap(cinfo->fbmem);
> + iounmap(cinfo->regbase - 0x600000);
> + } else if (board_addr > 0x01000000)
> + iounmap(cinfo->fbmem);
> + }
> + return ret;
>
> err_unmap_regbase:
> /* Parental advisory: explicit hack */
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/console/newport_con.c linux-2.6.18/drivers/video/console/newport_con.c
> --- linux-2.6.18-orig/drivers/video/console/newport_con.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/console/newport_con.c 2006-09-29 17:57:58.000000000 +0530
> @@ -323,6 +323,8 @@ static const char *newport_startup(void)
> return "SGI Newport";
>
> out_unmap:
> + iounmap((void *)npregs);
> + npregs = NULL;
> return NULL;
> }
>
> @@ -738,6 +740,7 @@ const struct consw newport_con = {
> #ifdef MODULE
> static int __init newport_console_init(void)
> {
> + int err;
>
> if (!sgi_gfxaddr)
> return NULL;
> @@ -746,7 +749,11 @@ static int __init newport_console_init(v
> npregs = (struct newport_regs *)/* ioremap cannot fail */
> ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
>
> - return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
> + err = take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
> + if (err)
> + iounmap((void *)npregs);
> +
> + return err;
> }
> module_init(newport_console_init);
>
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/cyberfb.c linux-2.6.18/drivers/video/cyberfb.c
> --- linux-2.6.18-orig/drivers/video/cyberfb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/cyberfb.c 2006-09-29 16:26:19.000000000 +0530
> @@ -1055,6 +1055,8 @@ int __init cyberfb_init(void)
>
> if (register_framebuffer(&fb_info) < 0) {
> DPRINTK("EXIT - register_framebuffer failed\n");
> + if (CyberBase)
> + iounmap(CyberBase);
> release_mem_region(CyberMem_phys, 0x400000);
> release_mem_region(CyberRegs_phys, 0x10000);
> return -EINVAL;
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/ffb.c linux-2.6.18/drivers/video/ffb.c
> --- linux-2.6.18-orig/drivers/video/ffb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/ffb.c 2006-09-29 11:19:09.000000000 +0530
> @@ -968,6 +968,8 @@ static int ffb_init_one(struct of_device
>
> if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
> printk(KERN_ERR "ffb: Could not allocate color map.\n");
> + of_iounmap(all->par.fbc, sizeof(struct ffb_fbc));
> + of_iounmap(all->par.dac, sizeof(struct ffb_dac));
> kfree(all);
> return -ENOMEM;
> }
> @@ -978,6 +980,8 @@ static int ffb_init_one(struct of_device
> if (err < 0) {
> printk(KERN_ERR "ffb: Could not register framebuffer.\n");
> fb_dealloc_cmap(&all->info.cmap);
> + of_iounmap(all->par.fbc, sizeof(struct ffb_fbc));
> + of_iounmap(all->par.dac, sizeof(struct ffb_dac));
> kfree(all);
> return err;
> }
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/fm2fb.c linux-2.6.18/drivers/video/fm2fb.c
> --- linux-2.6.18-orig/drivers/video/fm2fb.c 2006-08-24 02:46:33.000000000 +0530
> +++ linux-2.6.18/drivers/video/fm2fb.c 2006-09-29 11:20:30.000000000 +0530
> @@ -283,6 +283,7 @@ static int __devinit fm2fb_probe(struct
>
> if (register_framebuffer(info) < 0) {
> fb_dealloc_cmap(&info->cmap);
> + iounmap(info->screen_base);
> framebuffer_release(info);
> zorro_release_device(z);
> return -EINVAL;
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/hpfb.c linux-2.6.18/drivers/video/hpfb.c
> --- linux-2.6.18-orig/drivers/video/hpfb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/hpfb.c 2006-09-29 11:30:45.000000000 +0530
> @@ -295,6 +295,8 @@ static int __init hpfb_init_one(unsigned
>
> if (register_framebuffer(&fb_info) < 0) {
> fb_dealloc_cmap(&fb_info.cmap);
> + iounmap(fb_info.screen_base);
> + fb_info.screen_base = NULL;
> return 1;
> }
>
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/macfb.c linux-2.6.18/drivers/video/macfb.c
> --- linux-2.6.18-orig/drivers/video/macfb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/macfb.c 2006-09-29 18:14:42.000000000 +0530
> @@ -608,6 +608,22 @@ void __init macfb_setup(char *options)
> }
> }
>
> +static void __init iounmap_macfb(void)
> +{
> + if (valkyrie_cmap_regs)
> + iounmap(valkyrie_cmap_regs);
> + if (dafb_cmap_regs)
> + iounmap(dafb_cmap_regs);
> + if (v8_brazil_cmap_regs)
> + iounmap(v8_brazil_cmap_regs);
> + if (rbv_cmap_regs)
> + iounmap(rbv_cmap_regs);
> + if (civic_cmap_regs)
> + iounmap(civic_cmap_regs);
> + if (csc_cmap_regs)
> + iounmap(csc_cmap_regs);
> +}
> +
> static int __init macfb_init(void)
> {
> int video_cmap_len, video_is_nubus = 0;
> @@ -962,6 +978,10 @@ static int __init macfb_init(void)
> if (!err)
> printk("fb%d: %s frame buffer device\n",
> fb_info.node, fb_info.fix.id);
> + else {
> + iounmap(fb_info.screen_base);
> + iounmap_macfb();
> + }
> return err;
> }
>
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/offb.c linux-2.6.18/drivers/video/offb.c
> --- linux-2.6.18-orig/drivers/video/offb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/offb.c 2006-09-29 12:07:28.000000000 +0530
> @@ -392,6 +392,9 @@ static void __init offb_init_fb(const ch
> fb_alloc_cmap(&info->cmap, 256, 0);
>
> if (register_framebuffer(info) < 0) {
> + iounmap(par->cmap_adr);
> + par->cmap_adr = NULL;
> + iounmap(info->screen_base);
> kfree(info);
> release_mem_region(res_start, res_size);
> return;
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/platinumfb.c linux-2.6.18/drivers/video/platinumfb.c
> --- linux-2.6.18-orig/drivers/video/platinumfb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/platinumfb.c 2006-09-29 12:12:17.000000000 +0530
> @@ -623,6 +623,9 @@ static int __devinit platinumfb_probe(st
>
> rc = platinum_init_fb(info);
> if (rc != 0) {
> + iounmap(pinfo->frame_buffer);
> + iounmap(pinfo->platinum_regs);
> + iounmap(pinfo->cmap_regs);
> dev_set_drvdata(&odev->dev, NULL);
> framebuffer_release(info);
> }
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/pvr2fb.c linux-2.6.18/drivers/video/pvr2fb.c
> --- linux-2.6.18-orig/drivers/video/pvr2fb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/pvr2fb.c 2006-09-29 15:07:50.000000000 +0530
> @@ -903,6 +903,15 @@ static int __init pvr2fb_dc_init(void)
>
> static void pvr2fb_dc_exit(void)
> {
> + if (fb_info->screen_base) {
> + iounmap(fb_info->screen_base);
> + fb_info->screen_base = NULL;
> + }
> + if (currentpar->mmio_base) {
> + iounmap((void *)currentpar->mmio_base);
> + currentpar->mmio_base = 0;
> + }
> +
> free_irq(HW_EVENT_VSYNC, 0);
> #ifdef CONFIG_SH_DMA
> free_dma(pvr2dma);
> @@ -944,6 +953,15 @@ static int __devinit pvr2fb_pci_probe(st
>
> static void __devexit pvr2fb_pci_remove(struct pci_dev *pdev)
> {
> + if (fb_info->screen_base) {
> + iounmap(fb_info->screen_base);
> + fb_info->screen_base = NULL;
> + }
> + if (currentpar->mmio_base) {
> + iounmap((void *)currentpar->mmio_base);
> + currentpar->mmio_base = 0;
> + }
> +
> pci_release_regions(pdev);
> }
>
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/retz3fb.c linux-2.6.18/drivers/video/retz3fb.c
> --- linux-2.6.18-orig/drivers/video/retz3fb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/retz3fb.c 2006-09-29 16:06:39.000000000 +0530
> @@ -1423,8 +1423,10 @@ int __init retz3fb_init(void)
>
> do_install_cmap(0, fb_info);
>
> - if (register_framebuffer(fb_info) < 0)
> + if (register_framebuffer(fb_info) < 0) {
> + iounmap(zinfo->base);
> return -EINVAL;
> + }
>
> printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of "
> "video memory\n", fb_info->node,
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/S3triofb.c linux-2.6.18/drivers/video/S3triofb.c
> --- linux-2.6.18-orig/drivers/video/S3triofb.c 2006-09-21 10:15:41.000000000 +0530
> +++ linux-2.6.18/drivers/video/S3triofb.c 2006-09-29 18:22:25.000000000 +0530
> @@ -535,8 +535,11 @@ static void __init s3triofb_of_init(stru
> #endif
>
> fb_info.flags = FBINFO_FLAG_DEFAULT;
> - if (register_framebuffer(&fb_info) < 0)
> - return;
> + if (register_framebuffer(&fb_info) < 0) {
> + iounmap(fb_info.screen_base);
> + fb_info.screen_base = NULL;
> + return;
> + }
>
> printk("fb%d: S3 Trio frame buffer device on %s\n",
> fb_info.node, dp->full_name);
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/stifb.c linux-2.6.18/drivers/video/stifb.c
> --- linux-2.6.18-orig/drivers/video/stifb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/stifb.c 2006-09-29 12:42:57.000000000 +0530
> @@ -1291,6 +1291,7 @@ out_err3:
> out_err2:
> release_mem_region(fix->smem_start, fix->smem_len);
> out_err1:
> + iounmap(info->screen_base);
> fb_dealloc_cmap(&info->cmap);
> out_err0:
> kfree(fb);
> @@ -1364,6 +1365,8 @@ stifb_cleanup(void)
> unregister_framebuffer(sti->info);
> release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
> release_mem_region(info->fix.smem_start, info->fix.smem_len);
> + if (info->screen_base)
> + iounmap(info->screen_base);
> fb_dealloc_cmap(&info->cmap);
> kfree(info);
> }
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/tgafb.c linux-2.6.18/drivers/video/tgafb.c
> --- linux-2.6.18-orig/drivers/video/tgafb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/tgafb.c 2006-09-29 12:46:01.000000000 +0530
> @@ -1473,6 +1473,8 @@ tgafb_pci_register(struct pci_dev *pdev,
> return 0;
>
> err1:
> + if (mem_base)
> + iounmap(mem_base);
> release_mem_region(bar0_start, bar0_len);
> err0:
> kfree(all);
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/tridentfb.c linux-2.6.18/drivers/video/tridentfb.c
> --- linux-2.6.18-orig/drivers/video/tridentfb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/tridentfb.c 2006-09-29 16:46:59.000000000 +0530
> @@ -1130,7 +1130,8 @@ static int __devinit trident_pci_probe(s
>
> if (!request_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len, "tridentfb")) {
> debug("request_mem_region failed!\n");
> - return -1;
> + err = -1;
> + goto out_unmap;
> }
>
> fb_info.screen_base = ioremap_nocache(tridentfb_fix.smem_start,
> @@ -1139,7 +1140,8 @@ static int __devinit trident_pci_probe(s
> if (!fb_info.screen_base) {
> release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
> debug("ioremap failed\n");
> - return -1;
> + err = -1;
> + goto out_unmap;
> }
>
> output("%s board found\n", pci_name(dev));
> @@ -1162,8 +1164,10 @@ static int __devinit trident_pci_probe(s
> #endif
> fb_info.pseudo_palette = pseudo_pal;
>
> - if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp))
> - return -EINVAL;
> + if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp)) {
> + err = -EINVAL;
> + goto out_unmap;
> + }
> fb_alloc_cmap(&fb_info.cmap,256,0);
> if (defaultaccel && acc)
> default_var.accel_flags |= FB_ACCELF_TEXT;
> @@ -1174,12 +1178,20 @@ static int __devinit trident_pci_probe(s
> fb_info.device = &dev->dev;
> if (register_framebuffer(&fb_info) < 0) {
> printk(KERN_ERR "tridentfb: could not register Trident framebuffer\n");
> - return -EINVAL;
> + err = -EINVAL;
> + goto out_unmap;
> }
> output("fb%d: %s frame buffer device %dx%d-%dbpp\n",
> fb_info.node, fb_info.fix.id,default_var.xres,
> default_var.yres,default_var.bits_per_pixel);
> return 0;
> +
> +out_unmap:
> + if (default_par.io_virt)
> + iounmap(default_par.io_virt);
> + if (fb_info.screen_base)
> + iounmap(fb_info.screen_base);
> + return err;
> }
>
> static void __devexit trident_pci_remove(struct pci_dev * dev)
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/vesafb.c linux-2.6.18/drivers/video/vesafb.c
> --- linux-2.6.18-orig/drivers/video/vesafb.c 2006-09-21 10:15:42.000000000 +0530
> +++ linux-2.6.18/drivers/video/vesafb.c 2006-09-29 14:19:03.000000000 +0530
> @@ -456,6 +456,8 @@ static int __init vesafb_probe(struct pl
> info->node, info->fix.id);
> return 0;
> err:
> + if (info->screen_base)
> + iounmap(info->screen_base);
> framebuffer_release(info);
> release_mem_region(vesafb_fix.smem_start, size_total);
> return err;
> diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/video/virgefb.c linux-2.6.18/drivers/video/virgefb.c
> --- linux-2.6.18-orig/drivers/video/virgefb.c 2006-09-29 15:18:24.000000000 +0530
> +++ linux-2.6.18/drivers/video/virgefb.c 2006-09-29 15:20:34.000000000 +0530
> @@ -1799,7 +1799,7 @@ int __init virgefb_init(void)
> #warning release resources
> printk(KERN_ERR "virgefb.c: register_framebuffer failed\n");
> DPRINTK("EXIT\n");
> - return -EINVAL;
> + goto out_unmap;
> }
>
> printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n",
> @@ -1809,6 +1809,21 @@ int __init virgefb_init(void)
>
> DPRINTK("EXIT\n");
> return 0;
> +
> +out_unmap:
> + if (board_addr >= 0x01000000) {
> + if (v_ram)
> + iounmap((void*)v_ram);
> + if (vgaio_regs)
> + iounmap(vgaio_regs);
> + if (mmio_regs)
> + iounmap(mmio_regs);
> + if (vcode_switch_base)
> + iounmap((void*)vcode_switch_base);
> + v_ram = vcode_switch_base = 0;
> + vgaio_regs = mmio_regs = NULL;
> + }
> + return -EINVAL;
> }
>
>
>
Cheers,
Mauro.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [KJ] [PATCH] ioremap balanced with iounmap for drivers/video
2006-09-21 12:54 ` [KJ] " Amol Lad
` (7 preceding siblings ...)
(?)
@ 2006-09-29 18:41 ` Randy Dunlap
-1 siblings, 0 replies; 25+ messages in thread
From: Randy Dunlap @ 2006-09-29 18:41 UTC (permalink / raw)
To: kernel-janitors
On Fri, 29 Sep 2006 11:43:28 -0300 Mauro Carvalho Chehab wrote:
> Amol,
>
> We are not responsible for video adapter drivers, but, instead, for
> video capture adapters. I suggest you to send your patch to LKML, where
> all kernel maintainers are (linux-kernel@vger.kernel.org).
SCSI maintainer doesn't follow lkml. There could be others as well.
network drivers definitely should go to netdev mailing list.
video adapter drivers could also go to linux-fbdev mailing list...
lkml is not the answer for everything IHHO.
However, if Andrew Morton picks up the patch, he will likely
test it in -mm for awhile and then forward it to the correct
people so that they can merge it.
---
~Randy
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* [KJ] [PATCH] ioremap balanced with iounmap for drivers/atm
2006-09-21 12:54 ` [KJ] " Amol Lad
` (8 preceding siblings ...)
(?)
@ 2006-10-05 7:52 ` Amol Lad
-1 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-10-05 7:52 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only) to make sure the files are compiling without
any warning/error due to new changes
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
eni.c | 13 +++++++++++--
firestream.c | 6 ++++++
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/atm/eni.c linux-2.6.18/drivers/atm/eni.c
--- linux-2.6.18-orig/drivers/atm/eni.c 2006-09-21 10:15:31.000000000 +0530
+++ linux-2.6.18/drivers/atm/eni.c 2006-10-05 12:56:11.000000000 +0530
@@ -1746,6 +1746,7 @@ static int __devinit eni_do_init(struct
printk(KERN_ERR KERN_ERR DEV_LABEL "(itf %d): bad "
"magic - expected 0x%x, got 0x%x\n",dev->number,
ENI155_MAGIC,(unsigned) readl(&eprom->magic));
+ iounmap(base);
return -EINVAL;
}
}
@@ -1773,17 +1774,25 @@ static int __devinit eni_do_init(struct
printk(")\n");
printk(KERN_ERR DEV_LABEL "(itf %d): ERROR - wrong id 0x%x\n",
dev->number,(unsigned) eni_in(MID_RES_ID_MCON));
+ iounmap(base);
return -EINVAL;
}
error = eni_dev->asic ? get_esi_asic(dev) : get_esi_fpga(dev,base);
- if (error) return error;
+ if (error) {
+ iounmap(base);
+ return error;
+ }
for (i = 0; i < ESI_LEN; i++)
printk("%s%02X",i ? "-" : "",dev->esi[i]);
printk(")\n");
printk(KERN_NOTICE DEV_LABEL "(itf %d): %s,%s\n",dev->number,
eni_in(MID_RES_ID_MCON) & 0x200 ? "ASIC" : "FPGA",
media_name[eni_in(MID_RES_ID_MCON) & DAUGTHER_ID]);
- return suni_init(dev);
+
+ error = suni_init(dev);
+ if (error)
+ iounmap(base);
+ return error;
}
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/atm/firestream.c linux-2.6.18/drivers/atm/firestream.c
--- linux-2.6.18-orig/drivers/atm/firestream.c 2006-09-21 10:15:31.000000000 +0530
+++ linux-2.6.18/drivers/atm/firestream.c 2006-10-05 12:46:44.000000000 +0530
@@ -1699,6 +1699,7 @@ static int __devinit fs_init (struct fs_
/* This bit is documented as "RESERVED" */
if (isr & ISR_INIT_ERR) {
printk (KERN_ERR "Error initializing the FS... \n");
+ iounmap(dev->base);
return 1;
}
if (isr & ISR_INIT) {
@@ -1712,6 +1713,7 @@ static int __devinit fs_init (struct fs_
if (!to) {
printk (KERN_ERR "timeout initializing the FS... \n");
+ iounmap(dev->base);
return 1;
}
@@ -1792,6 +1794,7 @@ static int __devinit fs_init (struct fs_
if (!dev->atm_vccs) {
printk (KERN_WARNING "Couldn't allocate memory for VCC buffers. Woops!\n");
/* XXX Clean up..... */
+ iounmap(dev->base);
return 1;
}
memset (dev->atm_vccs, 0, dev->nchannels * sizeof (struct atm_vcc *));
@@ -1803,6 +1806,7 @@ static int __devinit fs_init (struct fs_
if (!dev->tx_inuse) {
printk (KERN_WARNING "Couldn't allocate memory for tx_inuse bits!\n");
/* XXX Clean up..... */
+ iounmap(dev->base);
return 1;
}
memset (dev->tx_inuse, 0, dev->nchannels / 8);
@@ -1832,6 +1836,7 @@ static int __devinit fs_init (struct fs_
if (request_irq (dev->irq, fs_irq, IRQF_SHARED, "firestream", dev)) {
printk (KERN_WARNING "couldn't get irq %d for firestream.\n", pci_dev->irq);
/* XXX undo all previous stuff... */
+ iounmap(dev->base);
return 1;
}
fs_dprintk (FS_DEBUG_INIT, "Grabbed irq %d for dev at %p.\n", dev->irq, dev);
@@ -2007,6 +2012,7 @@ static void __devexit firestream_remove_
for (i=0;i < FS_NR_RX_QUEUES;i++)
free_queue (dev, &dev->rx_rq[i]);
+ iounmap(dev->base);
fs_dprintk (FS_DEBUG_ALLOC, "Free fs-dev: %p\n", dev);
nxtdev = dev->next;
kfree (dev);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* [KJ] [PATCH] ioremap balanced with iounmap for sound
2006-09-21 12:54 ` [KJ] " Amol Lad
@ 2006-10-05 12:35 ` Amol Lad
-1 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-10-05 12:35 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only):
- using allmodconfig
- making sure the files are compiling without any warning/error due to
new changes
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
oss/btaudio.c | 2 ++
oss/dmasound/dmasound_awacs.c | 39 +++++++++++++++++++++++++++++++++++----
oss/msnd_pinnacle.c | 10 ++++++++++
pci/au88x0/au88x0.c | 1 +
pci/rme32.c | 4 ++++
pci/rme96.c | 4 ++++
pci/rme9652/hdsp.c | 21 ++++++++++++++++-----
pci/rme9652/hdspm.c | 6 +++++-
pci/rme9652/rme9652.c | 4 ++++
9 files changed, 81 insertions(+), 10 deletions(-)
---
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/btaudio.c linux-2.6.19-rc1/sound/oss/btaudio.c
--- linux-2.6.19-rc1-orig/sound/oss/btaudio.c 2006-09-21 10:15:52.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/btaudio.c 2006-10-05 15:21:32.000000000 +0530
@@ -1013,6 +1013,7 @@ static int __devinit btaudio_probe(struc
return 0;
fail4:
+ iounmap(bta->mmio);
unregister_sound_dsp(bta->dsp_analog);
fail3:
if (digital)
@@ -1051,6 +1052,7 @@ static void __devexit btaudio_remove(str
free_irq(bta->irq,bta);
release_mem_region(pci_resource_start(pci_dev,0),
pci_resource_len(pci_dev,0));
+ iounmap(bta->mmio);
/* remove from linked list */
if (bta = btaudios) {
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c
--- linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c 2006-10-05 14:01:04.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c 2006-10-05 17:34:42.000000000 +0530
@@ -3067,8 +3067,9 @@ printk("dmasound_pmac: Awacs/Screamer Co
udelay(1);
/* Initialize beep stuff */
- if ((res=setup_beep()))
- return res ;
+ res=setup_beep();
+ if (res)
+ goto out_unmap;
#ifdef CONFIG_PM
pmu_register_sleep_notifier(&awacs_sleep_notifier);
@@ -3160,7 +3161,26 @@ printk("dmasound_pmac: Awacs/Screamer Co
*/
input_register_device(awacs_beep_dev);
- return dmasound_init();
+ res = dmasound_init();
+ if (res)
+ goto out_unmap1;
+
+ return 0;
+
+out_unmap1:
+ if (is_pbook_3X00)
+ iounmap(latch_base);
+ else if (is_pbook_g3)
+ iounmap(macio_base);
+out_unmap:
+ if (i2s_node)
+ iounmap(i2s);
+ else
+ iounmap(awacs);
+ iounmap(awacs_txdma);
+ iounmap(awacs_rxdma);
+
+ return res;
}
static void __exit dmasound_awacs_cleanup(void)
@@ -3177,8 +3197,19 @@ static void __exit dmasound_awacs_cleanu
daca_cleanup();
break;
}
- dmasound_deinit();
+ if (is_pbook_3X00)
+ iounmap(latch_base);
+ else if (is_pbook_g3)
+ iounmap(macio_base);
+ if (i2s_node)
+ iounmap(i2s);
+ else
+ iounmap(awacs);
+ iounmap(awacs_txdma);
+ iounmap(awacs_rxdma);
+
+ dmasound_deinit();
}
MODULE_DESCRIPTION("PowerMac built-in audio driver.");
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/msnd_pinnacle.c linux-2.6.19-rc1/sound/oss/msnd_pinnacle.c
--- linux-2.6.19-rc1-orig/sound/oss/msnd_pinnacle.c 2006-09-21 10:15:52.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/msnd_pinnacle.c 2006-10-05 17:23:26.000000000 +0530
@@ -1441,6 +1441,8 @@ static int __init attach_multisound(void
static void __exit unload_multisound(void)
{
+ iounmap(dev.base);
+ dev.base = NULL;
release_region(dev.io, dev.numio);
free_irq(dev.irq, &dev);
unregister_sound_mixer(dev.mixer_minor);
@@ -1884,12 +1886,16 @@ static int __init msnd_init(void)
printk(KERN_INFO LOGNAME ": %u byte audio FIFOs (x2)\n", dev.fifosize);
if ((err = msnd_fifo_alloc(&dev.DAPF, dev.fifosize)) < 0) {
printk(KERN_ERR LOGNAME ": Couldn't allocate write FIFO\n");
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
if ((err = msnd_fifo_alloc(&dev.DARF, dev.fifosize)) < 0) {
printk(KERN_ERR LOGNAME ": Couldn't allocate read FIFO\n");
msnd_fifo_free(&dev.DAPF);
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
@@ -1897,6 +1903,8 @@ static int __init msnd_init(void)
printk(KERN_ERR LOGNAME ": Probe failed\n");
msnd_fifo_free(&dev.DAPF);
msnd_fifo_free(&dev.DARF);
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
@@ -1904,6 +1912,8 @@ static int __init msnd_init(void)
printk(KERN_ERR LOGNAME ": Attach failed\n");
msnd_fifo_free(&dev.DAPF);
msnd_fifo_free(&dev.DARF);
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/au88x0/au88x0.c linux-2.6.19-rc1/sound/pci/au88x0/au88x0.c
--- linux-2.6.19-rc1-orig/sound/pci/au88x0/au88x0.c 2006-09-21 10:15:52.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/au88x0/au88x0.c 2006-10-05 16:22:35.000000000 +0530
@@ -128,6 +128,7 @@ static int snd_vortex_dev_free(struct sn
// Take down PCI interface.
synchronize_irq(vortex->irq);
free_irq(vortex->irq, vortex);
+ iounmap(vortex->mmio);
pci_release_regions(vortex->pci_dev);
pci_disable_device(vortex->pci_dev);
kfree(vortex);
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme32.c linux-2.6.19-rc1/sound/pci/rme32.c
--- linux-2.6.19-rc1-orig/sound/pci/rme32.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme32.c 2006-10-05 16:52:01.000000000 +0530
@@ -1376,6 +1376,7 @@ static int __devinit snd_rme32_create(st
if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_DISABLED | IRQF_SHARED, "RME32", (void *) rme32)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
+ iounmap(rme32->iobase);
return -EBUSY;
}
rme32->irq = pci->irq;
@@ -1385,6 +1386,7 @@ static int __devinit snd_rme32_create(st
/* set up ALSA pcm device for S/PDIF */
if ((err = snd_pcm_new(rme32->card, "Digi32 IEC958", 0, 1, 1, &rme32->spdif_pcm)) < 0) {
+ iounmap(rme32->iobase);
return err;
}
rme32->spdif_pcm->private_data = rme32;
@@ -1417,6 +1419,7 @@ static int __devinit snd_rme32_create(st
if ((err = snd_pcm_new(rme32->card, "Digi32 ADAT", 1,
1, 1, &rme32->adat_pcm)) < 0)
{
+ iounmap(rme32->iobase);
return err;
}
rme32->adat_pcm->private_data = rme32;
@@ -1462,6 +1465,7 @@ static int __devinit snd_rme32_create(st
/* init switch interface */
if ((err = snd_rme32_create_switches(rme32->card, rme32)) < 0) {
+ iounmap(rme32->iobase);
return err;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme9652/hdsp.c linux-2.6.19-rc1/sound/pci/rme9652/hdsp.c
--- linux-2.6.19-rc1-orig/sound/pci/rme9652/hdsp.c 2006-10-05 14:01:05.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme9652/hdsp.c 2006-10-05 16:54:38.000000000 +0530
@@ -4936,6 +4936,7 @@ static int __devinit snd_hdsp_create(str
if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_DISABLED|IRQF_SHARED, "hdsp", (void *)hdsp)) {
snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq);
+ iounmap(hdsp->iobase);
return -EBUSY;
}
@@ -4943,8 +4944,10 @@ static int __devinit snd_hdsp_create(str
hdsp->precise_ptr = 1;
hdsp->use_midi_tasklet = 1;
- if ((err = snd_hdsp_initialize_memory(hdsp)) < 0)
+ if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
if (!is_9652 && !is_9632) {
/* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */
@@ -4964,8 +4967,10 @@ static int __devinit snd_hdsp_create(str
#endif
/* no iobox connected, we defer initialization */
snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n");
- if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
+ if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
return 0;
} else {
snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n");
@@ -4976,8 +4981,10 @@ static int __devinit snd_hdsp_create(str
}
}
- if ((err = snd_hdsp_enable_io(hdsp)) != 0)
+ if ((err = snd_hdsp_enable_io(hdsp)) != 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
if (is_9652)
hdsp->io_type = H9652;
@@ -4985,16 +4992,20 @@ static int __devinit snd_hdsp_create(str
if (is_9632)
hdsp->io_type = H9632;
- if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
+ if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
snd_hdsp_initialize_channels(hdsp);
snd_hdsp_initialize_midi_flush(hdsp);
hdsp->state |= HDSP_FirmwareLoaded;
- if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0)
+ if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
return 0;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme9652/hdspm.c linux-2.6.19-rc1/sound/pci/rme9652/hdspm.c
--- linux-2.6.19-rc1-orig/sound/pci/rme9652/hdspm.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme9652/hdspm.c 2006-10-05 16:55:32.000000000 +0530
@@ -3500,6 +3500,7 @@ static int __devinit snd_hdspm_create(st
IRQF_DISABLED | IRQF_SHARED, "hdspm",
(void *) hdspm)) {
snd_printk(KERN_ERR "HDSPM: unable to use IRQ %d\n", pci->irq);
+ iounmap(hdspm->iobase);
return -EBUSY;
}
@@ -3516,6 +3517,7 @@ static int __devinit snd_hdspm_create(st
= NULL) {
snd_printk(KERN_ERR "HDSPM: unable to kmalloc Mixer memory of %d Bytes\n",
(int)sizeof(struct hdspm_mixer));
+ iounmap(hdspm->iobase);
return err;
}
@@ -3524,8 +3526,10 @@ static int __devinit snd_hdspm_create(st
hdspm->qs_channels = MADI_QS_CHANNELS;
snd_printdd("create alsa devices.\n");
- if ((err = snd_hdspm_create_alsa_devices(card, hdspm)) < 0)
+ if ((err = snd_hdspm_create_alsa_devices(card, hdspm)) < 0) {
+ iounmap(hdspm->iobase);
return err;
+ }
snd_hdspm_initialize_midi_flush(hdspm);
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme9652/rme9652.c linux-2.6.19-rc1/sound/pci/rme9652/rme9652.c
--- linux-2.6.19-rc1-orig/sound/pci/rme9652/rme9652.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme9652/rme9652.c 2006-10-05 16:56:18.000000000 +0530
@@ -2502,6 +2502,7 @@ static int __devinit snd_rme9652_create(
if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_DISABLED|IRQF_SHARED, "rme9652", (void *)rme9652)) {
snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq);
+ iounmap(rme9652->iobase);
return -EBUSY;
}
rme9652->irq = pci->irq;
@@ -2562,14 +2563,17 @@ static int __devinit snd_rme9652_create(
pci_set_master(rme9652->pci);
if ((err = snd_rme9652_initialize_memory(rme9652)) < 0) {
+ iounmap(rme9652->iobase);
return err;
}
if ((err = snd_rme9652_create_pcm(card, rme9652)) < 0) {
+ iounmap(rme9652->iobase);
return err;
}
if ((err = snd_rme9652_create_controls(card, rme9652)) < 0) {
+ iounmap(rme9652->iobase);
return err;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme96.c linux-2.6.19-rc1/sound/pci/rme96.c
--- linux-2.6.19-rc1-orig/sound/pci/rme96.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme96.c 2006-10-05 16:53:17.000000000 +0530
@@ -1590,6 +1590,7 @@ snd_rme96_create(struct rme96 *rme96)
if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_DISABLED|IRQF_SHARED, "RME96", (void *)rme96)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
+ iounmap(rme96->iobase);
return -EBUSY;
}
rme96->irq = pci->irq;
@@ -1601,6 +1602,7 @@ snd_rme96_create(struct rme96 *rme96)
if ((err = snd_pcm_new(rme96->card, "Digi96 IEC958", 0,
1, 1, &rme96->spdif_pcm)) < 0)
{
+ iounmap(rme96->iobase);
return err;
}
rme96->spdif_pcm->private_data = rme96;
@@ -1619,6 +1621,7 @@ snd_rme96_create(struct rme96 *rme96)
if ((err = snd_pcm_new(rme96->card, "Digi96 ADAT", 1,
1, 1, &rme96->adat_pcm)) < 0)
{
+ iounmap(rme96->iobase);
return err;
}
rme96->adat_pcm->private_data = rme96;
@@ -1671,6 +1674,7 @@ snd_rme96_create(struct rme96 *rme96)
/* init switch interface */
if ((err = snd_rme96_create_switches(rme96->card, rme96)) < 0) {
+ iounmap(rme96->iobase);
return err;
}
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 25+ messages in thread* [PATCH] ioremap balanced with iounmap for sound
@ 2006-10-05 12:35 ` Amol Lad
0 siblings, 0 replies; 25+ messages in thread
From: Amol Lad @ 2006-10-05 12:35 UTC (permalink / raw)
To: kernel-janitors
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only):
- using allmodconfig
- making sure the files are compiling without any warning/error due to
new changes
Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
oss/btaudio.c | 2 ++
oss/dmasound/dmasound_awacs.c | 39 +++++++++++++++++++++++++++++++++++----
oss/msnd_pinnacle.c | 10 ++++++++++
pci/au88x0/au88x0.c | 1 +
pci/rme32.c | 4 ++++
pci/rme96.c | 4 ++++
pci/rme9652/hdsp.c | 21 ++++++++++++++++-----
pci/rme9652/hdspm.c | 6 +++++-
pci/rme9652/rme9652.c | 4 ++++
9 files changed, 81 insertions(+), 10 deletions(-)
---
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/btaudio.c linux-2.6.19-rc1/sound/oss/btaudio.c
--- linux-2.6.19-rc1-orig/sound/oss/btaudio.c 2006-09-21 10:15:52.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/btaudio.c 2006-10-05 15:21:32.000000000 +0530
@@ -1013,6 +1013,7 @@ static int __devinit btaudio_probe(struc
return 0;
fail4:
+ iounmap(bta->mmio);
unregister_sound_dsp(bta->dsp_analog);
fail3:
if (digital)
@@ -1051,6 +1052,7 @@ static void __devexit btaudio_remove(str
free_irq(bta->irq,bta);
release_mem_region(pci_resource_start(pci_dev,0),
pci_resource_len(pci_dev,0));
+ iounmap(bta->mmio);
/* remove from linked list */
if (bta = btaudios) {
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c
--- linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c 2006-10-05 14:01:04.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c 2006-10-05 17:34:42.000000000 +0530
@@ -3067,8 +3067,9 @@ printk("dmasound_pmac: Awacs/Screamer Co
udelay(1);
/* Initialize beep stuff */
- if ((res=setup_beep()))
- return res ;
+ res=setup_beep();
+ if (res)
+ goto out_unmap;
#ifdef CONFIG_PM
pmu_register_sleep_notifier(&awacs_sleep_notifier);
@@ -3160,7 +3161,26 @@ printk("dmasound_pmac: Awacs/Screamer Co
*/
input_register_device(awacs_beep_dev);
- return dmasound_init();
+ res = dmasound_init();
+ if (res)
+ goto out_unmap1;
+
+ return 0;
+
+out_unmap1:
+ if (is_pbook_3X00)
+ iounmap(latch_base);
+ else if (is_pbook_g3)
+ iounmap(macio_base);
+out_unmap:
+ if (i2s_node)
+ iounmap(i2s);
+ else
+ iounmap(awacs);
+ iounmap(awacs_txdma);
+ iounmap(awacs_rxdma);
+
+ return res;
}
static void __exit dmasound_awacs_cleanup(void)
@@ -3177,8 +3197,19 @@ static void __exit dmasound_awacs_cleanu
daca_cleanup();
break;
}
- dmasound_deinit();
+ if (is_pbook_3X00)
+ iounmap(latch_base);
+ else if (is_pbook_g3)
+ iounmap(macio_base);
+ if (i2s_node)
+ iounmap(i2s);
+ else
+ iounmap(awacs);
+ iounmap(awacs_txdma);
+ iounmap(awacs_rxdma);
+
+ dmasound_deinit();
}
MODULE_DESCRIPTION("PowerMac built-in audio driver.");
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/msnd_pinnacle.c linux-2.6.19-rc1/sound/oss/msnd_pinnacle.c
--- linux-2.6.19-rc1-orig/sound/oss/msnd_pinnacle.c 2006-09-21 10:15:52.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/msnd_pinnacle.c 2006-10-05 17:23:26.000000000 +0530
@@ -1441,6 +1441,8 @@ static int __init attach_multisound(void
static void __exit unload_multisound(void)
{
+ iounmap(dev.base);
+ dev.base = NULL;
release_region(dev.io, dev.numio);
free_irq(dev.irq, &dev);
unregister_sound_mixer(dev.mixer_minor);
@@ -1884,12 +1886,16 @@ static int __init msnd_init(void)
printk(KERN_INFO LOGNAME ": %u byte audio FIFOs (x2)\n", dev.fifosize);
if ((err = msnd_fifo_alloc(&dev.DAPF, dev.fifosize)) < 0) {
printk(KERN_ERR LOGNAME ": Couldn't allocate write FIFO\n");
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
if ((err = msnd_fifo_alloc(&dev.DARF, dev.fifosize)) < 0) {
printk(KERN_ERR LOGNAME ": Couldn't allocate read FIFO\n");
msnd_fifo_free(&dev.DAPF);
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
@@ -1897,6 +1903,8 @@ static int __init msnd_init(void)
printk(KERN_ERR LOGNAME ": Probe failed\n");
msnd_fifo_free(&dev.DAPF);
msnd_fifo_free(&dev.DARF);
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
@@ -1904,6 +1912,8 @@ static int __init msnd_init(void)
printk(KERN_ERR LOGNAME ": Attach failed\n");
msnd_fifo_free(&dev.DAPF);
msnd_fifo_free(&dev.DARF);
+ iounmap(dev.base);
+ dev.base = NULL;
return err;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/au88x0/au88x0.c linux-2.6.19-rc1/sound/pci/au88x0/au88x0.c
--- linux-2.6.19-rc1-orig/sound/pci/au88x0/au88x0.c 2006-09-21 10:15:52.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/au88x0/au88x0.c 2006-10-05 16:22:35.000000000 +0530
@@ -128,6 +128,7 @@ static int snd_vortex_dev_free(struct sn
// Take down PCI interface.
synchronize_irq(vortex->irq);
free_irq(vortex->irq, vortex);
+ iounmap(vortex->mmio);
pci_release_regions(vortex->pci_dev);
pci_disable_device(vortex->pci_dev);
kfree(vortex);
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme32.c linux-2.6.19-rc1/sound/pci/rme32.c
--- linux-2.6.19-rc1-orig/sound/pci/rme32.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme32.c 2006-10-05 16:52:01.000000000 +0530
@@ -1376,6 +1376,7 @@ static int __devinit snd_rme32_create(st
if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_DISABLED | IRQF_SHARED, "RME32", (void *) rme32)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
+ iounmap(rme32->iobase);
return -EBUSY;
}
rme32->irq = pci->irq;
@@ -1385,6 +1386,7 @@ static int __devinit snd_rme32_create(st
/* set up ALSA pcm device for S/PDIF */
if ((err = snd_pcm_new(rme32->card, "Digi32 IEC958", 0, 1, 1, &rme32->spdif_pcm)) < 0) {
+ iounmap(rme32->iobase);
return err;
}
rme32->spdif_pcm->private_data = rme32;
@@ -1417,6 +1419,7 @@ static int __devinit snd_rme32_create(st
if ((err = snd_pcm_new(rme32->card, "Digi32 ADAT", 1,
1, 1, &rme32->adat_pcm)) < 0)
{
+ iounmap(rme32->iobase);
return err;
}
rme32->adat_pcm->private_data = rme32;
@@ -1462,6 +1465,7 @@ static int __devinit snd_rme32_create(st
/* init switch interface */
if ((err = snd_rme32_create_switches(rme32->card, rme32)) < 0) {
+ iounmap(rme32->iobase);
return err;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme9652/hdsp.c linux-2.6.19-rc1/sound/pci/rme9652/hdsp.c
--- linux-2.6.19-rc1-orig/sound/pci/rme9652/hdsp.c 2006-10-05 14:01:05.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme9652/hdsp.c 2006-10-05 16:54:38.000000000 +0530
@@ -4936,6 +4936,7 @@ static int __devinit snd_hdsp_create(str
if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_DISABLED|IRQF_SHARED, "hdsp", (void *)hdsp)) {
snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq);
+ iounmap(hdsp->iobase);
return -EBUSY;
}
@@ -4943,8 +4944,10 @@ static int __devinit snd_hdsp_create(str
hdsp->precise_ptr = 1;
hdsp->use_midi_tasklet = 1;
- if ((err = snd_hdsp_initialize_memory(hdsp)) < 0)
+ if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
if (!is_9652 && !is_9632) {
/* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */
@@ -4964,8 +4967,10 @@ static int __devinit snd_hdsp_create(str
#endif
/* no iobox connected, we defer initialization */
snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n");
- if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
+ if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
return 0;
} else {
snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n");
@@ -4976,8 +4981,10 @@ static int __devinit snd_hdsp_create(str
}
}
- if ((err = snd_hdsp_enable_io(hdsp)) != 0)
+ if ((err = snd_hdsp_enable_io(hdsp)) != 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
if (is_9652)
hdsp->io_type = H9652;
@@ -4985,16 +4992,20 @@ static int __devinit snd_hdsp_create(str
if (is_9632)
hdsp->io_type = H9632;
- if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
+ if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
snd_hdsp_initialize_channels(hdsp);
snd_hdsp_initialize_midi_flush(hdsp);
hdsp->state |= HDSP_FirmwareLoaded;
- if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0)
+ if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) {
+ iounmap(hdsp->iobase);
return err;
+ }
return 0;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme9652/hdspm.c linux-2.6.19-rc1/sound/pci/rme9652/hdspm.c
--- linux-2.6.19-rc1-orig/sound/pci/rme9652/hdspm.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme9652/hdspm.c 2006-10-05 16:55:32.000000000 +0530
@@ -3500,6 +3500,7 @@ static int __devinit snd_hdspm_create(st
IRQF_DISABLED | IRQF_SHARED, "hdspm",
(void *) hdspm)) {
snd_printk(KERN_ERR "HDSPM: unable to use IRQ %d\n", pci->irq);
+ iounmap(hdspm->iobase);
return -EBUSY;
}
@@ -3516,6 +3517,7 @@ static int __devinit snd_hdspm_create(st
= NULL) {
snd_printk(KERN_ERR "HDSPM: unable to kmalloc Mixer memory of %d Bytes\n",
(int)sizeof(struct hdspm_mixer));
+ iounmap(hdspm->iobase);
return err;
}
@@ -3524,8 +3526,10 @@ static int __devinit snd_hdspm_create(st
hdspm->qs_channels = MADI_QS_CHANNELS;
snd_printdd("create alsa devices.\n");
- if ((err = snd_hdspm_create_alsa_devices(card, hdspm)) < 0)
+ if ((err = snd_hdspm_create_alsa_devices(card, hdspm)) < 0) {
+ iounmap(hdspm->iobase);
return err;
+ }
snd_hdspm_initialize_midi_flush(hdspm);
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme9652/rme9652.c linux-2.6.19-rc1/sound/pci/rme9652/rme9652.c
--- linux-2.6.19-rc1-orig/sound/pci/rme9652/rme9652.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme9652/rme9652.c 2006-10-05 16:56:18.000000000 +0530
@@ -2502,6 +2502,7 @@ static int __devinit snd_rme9652_create(
if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_DISABLED|IRQF_SHARED, "rme9652", (void *)rme9652)) {
snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq);
+ iounmap(rme9652->iobase);
return -EBUSY;
}
rme9652->irq = pci->irq;
@@ -2562,14 +2563,17 @@ static int __devinit snd_rme9652_create(
pci_set_master(rme9652->pci);
if ((err = snd_rme9652_initialize_memory(rme9652)) < 0) {
+ iounmap(rme9652->iobase);
return err;
}
if ((err = snd_rme9652_create_pcm(card, rme9652)) < 0) {
+ iounmap(rme9652->iobase);
return err;
}
if ((err = snd_rme9652_create_controls(card, rme9652)) < 0) {
+ iounmap(rme9652->iobase);
return err;
}
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/pci/rme96.c linux-2.6.19-rc1/sound/pci/rme96.c
--- linux-2.6.19-rc1-orig/sound/pci/rme96.c 2006-09-21 10:15:53.000000000 +0530
+++ linux-2.6.19-rc1/sound/pci/rme96.c 2006-10-05 16:53:17.000000000 +0530
@@ -1590,6 +1590,7 @@ snd_rme96_create(struct rme96 *rme96)
if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_DISABLED|IRQF_SHARED, "RME96", (void *)rme96)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
+ iounmap(rme96->iobase);
return -EBUSY;
}
rme96->irq = pci->irq;
@@ -1601,6 +1602,7 @@ snd_rme96_create(struct rme96 *rme96)
if ((err = snd_pcm_new(rme96->card, "Digi96 IEC958", 0,
1, 1, &rme96->spdif_pcm)) < 0)
{
+ iounmap(rme96->iobase);
return err;
}
rme96->spdif_pcm->private_data = rme96;
@@ -1619,6 +1621,7 @@ snd_rme96_create(struct rme96 *rme96)
if ((err = snd_pcm_new(rme96->card, "Digi96 ADAT", 1,
1, 1, &rme96->adat_pcm)) < 0)
{
+ iounmap(rme96->iobase);
return err;
}
rme96->adat_pcm->private_data = rme96;
@@ -1671,6 +1674,7 @@ snd_rme96_create(struct rme96 *rme96)
/* init switch interface */
if ((err = snd_rme96_create_switches(rme96->card, rme96)) < 0) {
+ iounmap(rme96->iobase);
return err;
}
^ permalink raw reply [flat|nested] 25+ messages in thread