aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmol Lad <amol@verismonetworks.com>2006-10-20 17:44:18 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2006-10-25 21:59:43 -0400
commit3efa9970bd0ac731302224ab9243693e91bc4bea (patch)
treead915a88d7e7e027deeb989e25b387ced29f4d45
parenta230a6785dd5af84b8b043a64d8df8adc81f3724 (diff)
[PATCH] ioremap balanced with iounmap for drivers/pcmcia
ioremap must be balanced by an iounmap and failing to do so can result in a memory leak. Signed-off-by: Amol Lad <amol@verismonetworks.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/pcmcia/at91_cf.c3
-rw-r--r--drivers/pcmcia/au1000_generic.c10
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c12
-rw-r--r--drivers/pcmcia/omap_cf.c3
4 files changed, 22 insertions, 6 deletions
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index f8db6e342cbb..3bcb7dc32995 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -310,9 +310,10 @@ static int __init at91_cf_probe(struct platform_device *pdev)
310 return 0; 310 return 0;
311 311
312fail2: 312fail2:
313 iounmap((void __iomem *) cf->socket.io_offset);
314 release_mem_region(io->start, io->end + 1 - io->start); 313 release_mem_region(io->start, io->end + 1 - io->start);
315fail1: 314fail1:
315 if (cf->socket.io_offset)
316 iounmap((void __iomem *) cf->socket.io_offset);
316 if (board->irq_pin) 317 if (board->irq_pin)
317 free_irq(board->irq_pin, cf); 318 free_irq(board->irq_pin, cf);
318fail0a: 319fail0a:
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 5387de6216fb..551bde5d9430 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -449,6 +449,16 @@ out_err:
449 del_timer_sync(&skt->poll_timer); 449 del_timer_sync(&skt->poll_timer);
450 pcmcia_unregister_socket(&skt->socket); 450 pcmcia_unregister_socket(&skt->socket);
451 flush_scheduled_work(); 451 flush_scheduled_work();
452 if (i == 0) {
453 iounmap(skt->virt_io + (u32)mips_io_port_base);
454 skt->virt_io = NULL;
455 }
456#ifndef CONFIG_MIPS_XXS1500
457 else {
458 iounmap(skt->virt_io + (u32)mips_io_port_base);
459 skt->virt_io = NULL;
460 }
461#endif
452 ops->hw_shutdown(skt); 462 ops->hw_shutdown(skt);
453 463
454 } 464 }
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index e070a2896769..3b72be880401 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -427,7 +427,7 @@ static int voltage_set(int slot, int vcc, int vpp)
427 reg |= BCSR1_PCCVCC1; 427 reg |= BCSR1_PCCVCC1;
428 break; 428 break;
429 default: 429 default:
430 return 1; 430 goto out_unmap;
431 } 431 }
432 432
433 switch(vpp) { 433 switch(vpp) {
@@ -438,15 +438,15 @@ static int voltage_set(int slot, int vcc, int vpp)
438 if(vcc == vpp) 438 if(vcc == vpp)
439 reg |= BCSR1_PCCVPP1; 439 reg |= BCSR1_PCCVPP1;
440 else 440 else
441 return 1; 441 goto out_unmap;
442 break; 442 break;
443 case 120: 443 case 120:
444 if ((vcc == 33) || (vcc == 50)) 444 if ((vcc == 33) || (vcc == 50))
445 reg |= BCSR1_PCCVPP0; 445 reg |= BCSR1_PCCVPP0;
446 else 446 else
447 return 1; 447 goto out_unmap;
448 default: 448 default:
449 return 1; 449 goto out_unmap;
450 } 450 }
451 451
452 /* first, turn off all power */ 452 /* first, turn off all power */
@@ -457,6 +457,10 @@ static int voltage_set(int slot, int vcc, int vpp)
457 457
458 iounmap(bcsr_io); 458 iounmap(bcsr_io);
459 return 0; 459 return 0;
460
461out_unmap:
462 iounmap(bcsr_io);
463 return 1;
460} 464}
461 465
462#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V 466#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index c8e838c69766..06bf7f48836e 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -309,9 +309,10 @@ static int __devinit omap_cf_probe(struct device *dev)
309 return 0; 309 return 0;
310 310
311fail2: 311fail2:
312 iounmap((void __iomem *) cf->socket.io_offset);
313 release_mem_region(cf->phys_cf, SZ_8K); 312 release_mem_region(cf->phys_cf, SZ_8K);
314fail1: 313fail1:
314 if (cf->socket.io_offset)
315 iounmap((void __iomem *) cf->socket.io_offset);
315 free_irq(irq, cf); 316 free_irq(irq, cf);
316fail0: 317fail0:
317 kfree(cf); 318 kfree(cf);