Scott Thompson | 1 Aug 2007 06:05
Favicon

[PATCH]: sound: ioremap/iounmap function balancing audit


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).

i810_audio.c had a 'fixme' issue regarding ioremap fail that was
addressed as well.

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
 <at>  <at>  -3362,7 +3362,7  <at>  <at>  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))) { /* <at> 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))) {
(Continue reading)

Andrew Morton | 1 Aug 2007 06:52

Re: [PATCH]: sound: ioremap/iounmap function balancing audit

On Wed, 01 Aug 2007 00:05:59 -0400 "Scott Thompson" <postfail <at> hushmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1

You might want to consider losing that stuff when sending patches - it just
makes things harder.

> 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).
> 
> i810_audio.c had a 'fixme' issue regarding ioremap fail that was
> addressed as well.
> 
> 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
>  <at>  <at>  -3362,7 +3362,7  <at>  <at>  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,
(Continue reading)

Scott Thompson | 1 Aug 2007 07:45
Favicon

Re: [PATCH]: sound: ioremap/iounmap function balancing audit

On Wed, 01 Aug 2007 00:52:26 -0400 Andrew Morton <akpm <at> linux-
foundation.org> wrote:
>The patch is terribly wordwrapped.
>
>I suspect a lot of the code which you're fixing is about to be 
>removed. 
>But I suppose we should fix it before removing it anwyay.  Still, 
>please
>split this patch into at least one for sound/oss and one for 
>sound/soc and
>sound/pci, thanks.

Will do, though wordwrapping issues will still be there.  The part 
of the function I was patching in i810_probe is nested so deep 
birds have taken up residence.

---------------------------------------
Scott Thompson / postfail <at> hushmail.com
---------------------------------------

--
Click to get kitchen cabinets direct, wholesale prices, special offer
http://tagline.hushmail.com/fc/Ioyw6h4eNQG1ASUGkA6d4CPtDhN6vhvI3LexQ7Y94JEpBntvwniuyK/

-
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

Scott Thompson | 1 Aug 2007 07:57
Favicon

[PATCH 1/3] sound/oss ioremap/iounmap balancing

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
 <at>  <at>  -3362,7 +3362,7  <at>  <at>  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))) { /* <at> 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",
 <at>  <at>  -3383,6 +3383,10  <at>  <at>  static int __devinit i810_probe(struct 
pci_dev *pci_dev, const struct pci_device
 					card->use_mmio = 0;
(Continue reading)

Scott Thompson | 1 Aug 2007 08:02
Favicon

[PATCH 2/3] sound/pci ioremap/iounmap balancing

ioremap / iounmap balancing in sound/pci tree

Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
---
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index ac007ce..871b09f 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
 <at>  <at>  -1319,6 +1319,13  <at>  <at>  static int __devinit snd_mixart_probe(struct 
pci_dev *pci,
 						   pci_resource_len(pci, i));
 	}

+	if (!mgr->mem[0].virt || !mgr->mem[1].virt){
+		printk(KERN_ERR "unable to remap resource 0x%lx and/or 0x%lx\n",
+			mgr->mem[0].phys, mgr->mem[1].phys);
+		snd_mixart_free(mgr);
+		return -EBUSY;
+	}
+
 	if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED,
 			CARD_NAME, mgr)) {
 		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 618653e..d62d32a 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
 <at>  <at>  -1373,6 +1373,7  <at>  <at>  static int __devinit snd_rme32_create(struct 
rme32 * rme32)
 	if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_SHARED,
(Continue reading)

Scott Thompson | 1 Aug 2007 08:06
Favicon

[PATCH 3/3] sound/soc ioremap/iounmap balancing

ioremap / iounmap balancing in sound/soc tree

Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
---
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c 
b/sound/soc/s3c24xx/s3c24xx-i2s.c
index 39f0246..cd89c41 100644
--- a/sound/soc/s3c24xx/s3c24xx-i2s.c
+++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
 <at>  <at>  -385,6 +385,7  <at>  <at>  static int s3c24xx_i2s_probe(struct 
platform_device *pdev)
 	s3c24xx_i2s.iis_clk=clk_get(&pdev->dev, "iis");
 	if (s3c24xx_i2s.iis_clk == NULL) {
 		DBG("failed to get iis_clock\n");
+		iounmap(s3c24xx_i2s.regs);
 		return -ENODEV;
 	}
 	clk_enable(s3c24xx_i2s.iis_clk);

--
Click to get freedom from your annoying glasses. Save on LASIK surgery.
http://tagline.hushmail.com/fc/Ioyw6h4eJhpY2lk39qq0GYowuzjUjbLmD7mg54cZU7ogIFKBTZa55s/

-
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Takashi Iwai | 1 Aug 2007 12:38
Picon

Re: [PATCH 2/3] sound/pci ioremap/iounmap balancing

At Wed, 01 Aug 2007 02:02:56 -0400,
Scott Thompson wrote:
> 
> ioremap / iounmap balancing in sound/pci tree
> 
> Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
> ---
> diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
> index ac007ce..871b09f 100644
> --- a/sound/pci/mixart/mixart.c
> +++ b/sound/pci/mixart/mixart.c
>  <at>  <at>  -1319,6 +1319,13  <at>  <at>  static int __devinit snd_mixart_probe(struct 
> pci_dev *pci,
>  						   pci_resource_len(pci, i));
>  	}
>  
> +	if (!mgr->mem[0].virt || !mgr->mem[1].virt){
> +		printk(KERN_ERR "unable to remap resource 0x%lx and/or 0x%lx\n",
> +			mgr->mem[0].phys, mgr->mem[1].phys);
> +		snd_mixart_free(mgr);
> +		return -EBUSY;
> +	}
> +
>  	if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED,
>  			CARD_NAME, mgr)) {
>  		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);

This would be rater a lacking check of returned errors.

The other changes look incorrect.  All these drivers use
(Continue reading)

Scott Thompson | 1 Aug 2007 15:25
Favicon

Re: [PATCH 2/3] sound/pci ioremap/iounmap balancing


On Wed, 01 Aug 2007 06:38:16 -0400 Takashi Iwai <tiwai <at> suse.de> 
wrote:
>This would be rater a lacking check of returned errors.
>
>The other changes look incorrect.  All these drivers use
>card->private_free callback to release the resources even for the
>error exit.  Thus, you don't need iounmap in each place.
>
>
>thanks,
>
>Takashi

Missed the callback on the audit, will repost this patch 
(sound/pci) with just the unchecked returns...

---------------------------------------
Scott Thompson / postfail <at> hushmail.com
---------------------------------------

--
Click here for a free search to find a personal injury lawyer in your area.
http://tagline.hushmail.com/fc/Ioyw6h4fOfoaL5grSba8qnlenBibb9zjK5zUaQHZiVV0JZfJFmwnj3/

-
To unsubscribe from this list: send the line "unsubscribe linux-sound" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

Scott Thompson | 1 Aug 2007 15:33
Favicon

[PATCH] sound/pci ioremap unchecked return

two unchecked ioremap calls.  upon further review and discussion 
these are only 'valid' changes from previously posted "[PATCH 2/3] 
sound/pci ioremap/iounmap balancing".

Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
---
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index ac007ce..871b09f 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
 <at>  <at>  -1319,6 +1319,13  <at>  <at>  static int __devinit snd_mixart_probe(struct
pci_dev *pci,
                            pci_resource_len(pci, i));
     }

+    if (!mgr->mem[0].virt || !mgr->mem[1].virt){
+        printk(KERN_ERR "unable to remap resource 0x%lx and/or 
0x%lx\n",
+            mgr->mem[0].phys, mgr->mem[1].phys);
+        snd_mixart_free(mgr);
+        return -EBUSY;
+    }
+
     if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED,
             CARD_NAME, mgr)) {
         snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);

--
Click here to double your salary by becoming a medical transcriber.
http://tagline.hushmail.com/fc/Ioyw6h4eKoY9b45qdapjPR3Z3SZM2SyWTcOTz330fym9TiGfPbAR8i/
(Continue reading)

joe | 13 Aug 2007 08:33

[PATCH] [369/2many] MAINTAINERS - PCI SOUND DRIVERS (ES1370, ES1371 and SONICVIBES)

Add file pattern to MAINTAINER entry

Signed-off-by: Joe Perches <joe <at> perches.com>

diff --git a/MAINTAINERS b/MAINTAINERS
index 93f385f..59ba494 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
 <at>  <at>  -3552,6 +3552,9  <at>  <at>  M:	sailer <at> ife.ee.ethz.ch
 L:	linux-sound <at> vger.kernel.org
 W:	http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html
 S:	Maintained
+F:	sound/pci/ens1370.c
+F:	sound/pci/ens1371.c
+F:	sound/pci/sonicvibes.c

 PCI SUBSYSTEM
 P:	Greg Kroah-Hartman
-
To unsubscribe from this list: send the line "unsubscribe linux-sound" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane