diff options
author | Amol Lad <amol@verismonetworks.com> | 2006-10-20 02:29:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:26:43 -0400 |
commit | fca4edb48b693d9df7de4c42d91b4158d8b7e347 (patch) | |
tree | 432e0d3444a27877920ed5469a41f6f294974ba3 /drivers/isdn/hisax | |
parent | 6220ec7844fda2686496013a66b5b9169976b991 (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>
Diffstat (limited to 'drivers/isdn/hisax')
-rw-r--r-- | drivers/isdn/hisax/diva.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 7e95f04f13da..3dacfff93f5f 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c | |||
@@ -716,8 +716,10 @@ release_io_diva(struct IsdnCardState *cs) | |||
716 | 716 | ||
717 | *cfg = 0; /* disable INT0/1 */ | 717 | *cfg = 0; /* disable INT0/1 */ |
718 | *cfg = 2; /* reset pending INT0 */ | 718 | *cfg = 2; /* reset pending INT0 */ |
719 | iounmap((void *)cs->hw.diva.cfg_reg); | 719 | if (cs->hw.diva.cfg_reg) |
720 | iounmap((void *)cs->hw.diva.pci_cfg); | 720 | iounmap((void *)cs->hw.diva.cfg_reg); |
721 | if (cs->hw.diva.pci_cfg) | ||
722 | iounmap((void *)cs->hw.diva.pci_cfg); | ||
721 | return; | 723 | return; |
722 | } else if (cs->subtyp != DIVA_IPAC_ISA) { | 724 | } else if (cs->subtyp != DIVA_IPAC_ISA) { |
723 | del_timer(&cs->hw.diva.tl); | 725 | del_timer(&cs->hw.diva.tl); |
@@ -734,6 +736,23 @@ release_io_diva(struct IsdnCardState *cs) | |||
734 | } | 736 | } |
735 | 737 | ||
736 | static void | 738 | static void |
739 | iounmap_diva(struct IsdnCardState *cs) | ||
740 | { | ||
741 | if ((cs->subtyp == DIVA_IPAC_PCI) || (cs->subtyp == DIVA_IPACX_PCI)) { | ||
742 | if (cs->hw.diva.cfg_reg) { | ||
743 | iounmap((void *)cs->hw.diva.cfg_reg); | ||
744 | cs->hw.diva.cfg_reg = 0; | ||
745 | } | ||
746 | if (cs->hw.diva.pci_cfg) { | ||
747 | iounmap((void *)cs->hw.diva.pci_cfg); | ||
748 | cs->hw.diva.pci_cfg = 0; | ||
749 | } | ||
750 | } | ||
751 | |||
752 | return; | ||
753 | } | ||
754 | |||
755 | static void | ||
737 | reset_diva(struct IsdnCardState *cs) | 756 | reset_diva(struct IsdnCardState *cs) |
738 | { | 757 | { |
739 | if (cs->subtyp == DIVA_IPAC_ISA) { | 758 | if (cs->subtyp == DIVA_IPAC_ISA) { |
@@ -1069,11 +1088,13 @@ setup_diva(struct IsdnCard *card) | |||
1069 | 1088 | ||
1070 | if (!cs->irq) { | 1089 | if (!cs->irq) { |
1071 | printk(KERN_WARNING "Diva: No IRQ for PCI card found\n"); | 1090 | printk(KERN_WARNING "Diva: No IRQ for PCI card found\n"); |
1091 | iounmap_diva(cs); | ||
1072 | return(0); | 1092 | return(0); |
1073 | } | 1093 | } |
1074 | 1094 | ||
1075 | if (!cs->hw.diva.cfg_reg) { | 1095 | if (!cs->hw.diva.cfg_reg) { |
1076 | printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n"); | 1096 | printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n"); |
1097 | iounmap_diva(cs); | ||
1077 | return(0); | 1098 | return(0); |
1078 | } | 1099 | } |
1079 | cs->irq_flags |= IRQF_SHARED; | 1100 | cs->irq_flags |= IRQF_SHARED; |
@@ -1123,6 +1144,7 @@ ready: | |||
1123 | CardType[card->typ], | 1144 | CardType[card->typ], |
1124 | cs->hw.diva.cfg_reg, | 1145 | cs->hw.diva.cfg_reg, |
1125 | cs->hw.diva.cfg_reg + bytecnt); | 1146 | cs->hw.diva.cfg_reg + bytecnt); |
1147 | iounmap_diva(cs); | ||
1126 | return (0); | 1148 | return (0); |
1127 | } | 1149 | } |
1128 | } | 1150 | } |