mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/9] sound/oss/btaudio.c: ioremap balanced with iounmap
@ 2006-10-06  5:38 Amol Lad
  2006-10-06 20:50 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Amol Lad @ 2006-10-06  5:38 UTC (permalink / raw)
  To: linux kernel; +Cc: Andrew Morton

ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.

Tested (compilation only):
- using allmodconfig
- making sure the files are compiling without any warning/error due to
new changes

Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
Forwarding to lkml as got no response from linux-sound
---
 btaudio.c |    2 ++
 1 files changed, 2 insertions(+)
---
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/btaudio.c linux-2.6.19-rc1/sound/oss/btaudio.c
--- linux-2.6.19-rc1-orig/sound/oss/btaudio.c	2006-09-21 10:15:52.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/btaudio.c	2006-10-05 15:21:32.000000000 +0530
@@ -1013,6 +1013,7 @@ static int __devinit btaudio_probe(struc
         return 0;
 
  fail4:
+	iounmap(bta->mmio);
 	unregister_sound_dsp(bta->dsp_analog);
  fail3:
 	if (digital)
@@ -1051,6 +1052,7 @@ static void __devexit btaudio_remove(str
         free_irq(bta->irq,bta);
 	release_mem_region(pci_resource_start(pci_dev,0),
 			   pci_resource_len(pci_dev,0));
+	iounmap(bta->mmio);
 
 	/* remove from linked list */
 	if (bta == btaudios) {



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/9] sound/oss/btaudio.c: ioremap balanced with iounmap
  2006-10-06  5:38 [PATCH 1/9] sound/oss/btaudio.c: ioremap balanced with iounmap Amol Lad
@ 2006-10-06 20:50 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2006-10-06 20:50 UTC (permalink / raw)
  To: Amol Lad; +Cc: linux kernel

On Fri, 06 Oct 2006 11:08:52 +0530
Amol Lad <amol@verismonetworks.com> wrote:

> ioremap must be balanced by an iounmap and failing to do so can result
> in a memory leak.
> 
> Tested (compilation only):
> - using allmodconfig
> - making sure the files are compiling without any warning/error due to
> new changes
> 
> Signed-off-by: Amol Lad <amol@verismonetworks.com>
> ---
> Forwarding to lkml as got no response from linux-sound
> ---
>  btaudio.c |    2 ++
>  1 files changed, 2 insertions(+)
> ---
> diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/btaudio.c linux-2.6.19-rc1/sound/oss/btaudio.c
> --- linux-2.6.19-rc1-orig/sound/oss/btaudio.c	2006-09-21 10:15:52.000000000 +0530
> +++ linux-2.6.19-rc1/sound/oss/btaudio.c	2006-10-05 15:21:32.000000000 +0530
> @@ -1013,6 +1013,7 @@ static int __devinit btaudio_probe(struc
>          return 0;
>  
>   fail4:
> +	iounmap(bta->mmio);
>  	unregister_sound_dsp(bta->dsp_analog);
>   fail3:
>  	if (digital)
> @@ -1051,6 +1052,7 @@ static void __devexit btaudio_remove(str
>          free_irq(bta->irq,bta);
>  	release_mem_region(pci_resource_start(pci_dev,0),
>  			   pci_resource_len(pci_dev,0));
> +	iounmap(bta->mmio);
>  
>  	/* remove from linked list */
>  	if (bta == btaudios) {

No, that misses several cases.  Please review this version:

--- a/sound/oss/btaudio.c~sound-oss-btaudioc-ioremap-balanced-with-iounmap
+++ a/sound/oss/btaudio.c
@@ -1020,6 +1020,7 @@ static int __devinit btaudio_probe(struc
  fail2:
         free_irq(bta->irq,bta);	
  fail1:
+	iounmap(bta->mmio);
 	kfree(bta);
  fail0:
 	release_mem_region(pci_resource_start(pci_dev,0),
@@ -1051,6 +1052,7 @@ static void __devexit btaudio_remove(str
         free_irq(bta->irq,bta);
 	release_mem_region(pci_resource_start(pci_dev,0),
 			   pci_resource_len(pci_dev,0));
+	iounmap(bta->mmio);
 
 	/* remove from linked list */
 	if (bta == btaudios) {
_


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-06 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-06  5:38 [PATCH 1/9] sound/oss/btaudio.c: ioremap balanced with iounmap Amol Lad
2006-10-06 20:50 ` Andrew Morton

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

all inboxes | Powered by JetHome®