public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] sound/oss ioremap/iounmap balancing
@ 2007-08-01  5:57 Scott Thompson
  0 siblings, 0 replies; only message in thread
From: Scott Thompson @ 2007-08-01  5:57 UTC (permalink / raw)
  To: linux-sound

This patch, along with previously submitted dmasound_awacs.c patch, 
completes an audit of the 'sound' tree for ioremap/iounmap 
balancing and return code checking on ioremap calls.
  ioremap() must be balanced by an iounmap() (else this causes a 
memory leak).

Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
---
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
index f5e31f1..407958c 100644
--- a/sound/oss/i810_audio.c
+++ b/sound/oss/i810_audio.c
@@ -3362,7 +3362,7 @@ static int __devinit i810_probe(struct 
pci_dev *pci_dev, const struct pci_device
 
 	if (card->use_mmio) {
 		if (request_mem_region(card->ac97base_mmio_phys, 512, "ich_audio 
MMBAR")) {
-			if ((card->ac97base_mmio = ioremap(card->ac97base_mmio_phys, 
512))) { /*@FIXME can ioremap fail? don't know (jsaw) */
+			if ((card->ac97base_mmio = ioremap(card->ac97base_mmio_phys, 
512))) { 
 				if (request_mem_region(card->iobase_mmio_phys, 256, "ich_audio 
MBBAR")) {
 					if ((card->iobase_mmio = ioremap(card->iobase_mmio_phys, 
256))) {
 						printk(KERN_INFO "i810: %s mmio at 0x%04lx and 0x%04lx\n",
@@ -3383,6 +3383,10 @@ static int __devinit i810_probe(struct 
pci_dev *pci_dev, const struct pci_device
 					card->use_mmio = 0;
 				}
 			}
+			else {
+				card->use_mmio;
+				release_mem_region(card->ac97base_mmio_phys, 512);
+			}
 		}
 		else {
 			card->use_mmio = 0;
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
index f1f49eb..117f79d 100644
--- a/sound/oss/msnd_pinnacle.c
+++ b/sound/oss/msnd_pinnacle.c
@@ -1912,6 +1912,9 @@ static int __init msnd_init(void)
 
 static void __exit msdn_cleanup(void)
 {
+	if (dev.base)
+		iounmap(dev.base);
+
 	unload_multisound();
 	msnd_fifo_free(&dev.DAPF);
 	msnd_fifo_free(&dev.DARF);

--
Click for free info on online degrees and make up to $150K/ year.
http://tagline.hushmail.com/fc/Ioyw6h4eqxfQwlYnfxENxHi266P9jFLejoyBEHTKtJ1SIH45HWWzON/


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-01  5:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-01  5:57 [PATCH 1/3] sound/oss ioremap/iounmap balancing Scott Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox