aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmol Lad <amol@verismonetworks.com>2006-10-19 23:29:06 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 10:26:43 -0700
commitfca4edb48b693d9df7de4c42d91b4158d8b7e347 (patch)
tree432e0d3444a27877920ed5469a41f6f294974ba3
parent6220ec7844fda2686496013a66b5b9169976b991 (diff)
[PATCH] drivers/isdn: ioremap balanced with iounmap
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> Acked-by: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/isdn/hisax/diva.c26
-rw-r--r--drivers/isdn/hysdn/boardergo.c2
2 files changed, 25 insertions, 3 deletions
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 7e95f04f13d..3dacfff93f5 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -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 --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c
index 8bbe33ae06d..82e42a80dc4 100644
--- a/drivers/isdn/hysdn/boardergo.c
+++ b/drivers/isdn/hysdn/boardergo.c
@@ -403,7 +403,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 */