All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] AMD Au1x00: fix DMA init/cleanup
@ 2006-03-20 21:20 Sergei Shtylylov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylylov @ 2006-03-20 21:20 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

Hello.

      AMD Au1x00 ALSA driver causes kernel oops in au1000_init() by trying to
set DMA channel to -1 in yet unallocated audio streams. Here's the patch that
staightens up DMA init/cleanup code.

WBR, Sergei



[-- Attachment #2: Au1x00-ALSA-fix-DMA-init-and-cleanup.patch --]
[-- Type: text/plain, Size: 1798 bytes --]

diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index 6d8f8b3..a7a221a 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -610,14 +610,17 @@ snd_au1000_free(struct snd_card *card)
 		release_and_free_resource(au1000->ac97_res_port);
 	}
 
-	if (au1000->stream[PLAYBACK]->dma >= 0)
-		free_au1000_dma(au1000->stream[PLAYBACK]->dma);
-
-	if (au1000->stream[CAPTURE]->dma >= 0)
-		free_au1000_dma(au1000->stream[CAPTURE]->dma);
+	if (au1000->stream[PLAYBACK]) {
+	  	if (au1000->stream[PLAYBACK]->dma >= 0)
+			free_au1000_dma(au1000->stream[PLAYBACK]->dma);
+		kfree(au1000->stream[PLAYBACK]);
+	}
 
-	kfree(au1000->stream[PLAYBACK]);
-	kfree(au1000->stream[CAPTURE]);
+	if (au1000->stream[CAPTURE]) {
+		if (au1000->stream[CAPTURE]->dma >= 0)
+			free_au1000_dma(au1000->stream[CAPTURE]->dma);
+		kfree(au1000->stream[CAPTURE]);
+	}
 }
 
 
@@ -636,15 +630,19 @@ au1000_init(void)
 
 	card->private_free = snd_au1000_free;
 	au1000 = card->private_data;
-	/* so that snd_au1000_free will work as intended */
 	au1000->card = card;
-	au1000->stream[PLAYBACK]->dma = -1;
-	au1000->stream[CAPTURE]->dma = -1;
- 	au1000->ac97_res_port = NULL;
+
 	au1000->stream[PLAYBACK] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
-	au1000->stream[CAPTURE] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
+	au1000->stream[CAPTURE ] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
+	/* so that snd_au1000_free will work as intended */
+ 	au1000->ac97_res_port = NULL;
+	if (au1000->stream[PLAYBACK])
+		au1000->stream[PLAYBACK]->dma = -1;
+	if (au1000->stream[CAPTURE ])
+		au1000->stream[CAPTURE ]->dma = -1;
+
 	if (au1000->stream[PLAYBACK] == NULL ||
-	    au1000->stream[CAPTURE] == NULL) {
+	    au1000->stream[CAPTURE ] == NULL) {
 		snd_card_free(card);
 		return -ENOMEM;
 	}



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

* [PATCH] AMD Au1x00: fix DMA init/cleanup
@ 2006-03-21  0:59 Sergei Shtylylov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylylov @ 2006-03-21  0:59 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

Hello.

    Reposting with signoff which I constantly forget about... :-/

    AMD Au1x00 ALSA driver causes kernel oops in au1000_init() by trying to
set DMA channel to -1 in yet unallocated audio streams. Here's the patch that
staightens up DMA init/cleanup code.

WBR, Sergei

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>


[-- Attachment #2: Au1x00-ALSA-fix-DMA-init-and-cleanup.patch --]
[-- Type: text/plain, Size: 1799 bytes --]

diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index 6d8f8b3..a7a221a 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -610,14 +610,17 @@ snd_au1000_free(struct snd_card *card)
 		release_and_free_resource(au1000->ac97_res_port);
 	}
 
-	if (au1000->stream[PLAYBACK]->dma >= 0)
-		free_au1000_dma(au1000->stream[PLAYBACK]->dma);
-
-	if (au1000->stream[CAPTURE]->dma >= 0)
-		free_au1000_dma(au1000->stream[CAPTURE]->dma);
+	if (au1000->stream[PLAYBACK]) {
+	  	if (au1000->stream[PLAYBACK]->dma >= 0)
+			free_au1000_dma(au1000->stream[PLAYBACK]->dma);
+		kfree(au1000->stream[PLAYBACK]);
+	}
 
-	kfree(au1000->stream[PLAYBACK]);
-	kfree(au1000->stream[CAPTURE]);
+	if (au1000->stream[CAPTURE]) {
+		if (au1000->stream[CAPTURE]->dma >= 0)
+			free_au1000_dma(au1000->stream[CAPTURE]->dma);
+		kfree(au1000->stream[CAPTURE]);
+	}
 }
 
 
@@ -636,15 +630,19 @@ au1000_init(void)
 
 	card->private_free = snd_au1000_free;
 	au1000 = card->private_data;
-	/* so that snd_au1000_free will work as intended */
 	au1000->card = card;
-	au1000->stream[PLAYBACK]->dma = -1;
-	au1000->stream[CAPTURE]->dma = -1;
- 	au1000->ac97_res_port = NULL;
+
 	au1000->stream[PLAYBACK] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
-	au1000->stream[CAPTURE] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
+	au1000->stream[CAPTURE ] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
+	/* so that snd_au1000_free will work as intended */
+ 	au1000->ac97_res_port = NULL;
+	if (au1000->stream[PLAYBACK])
+		au1000->stream[PLAYBACK]->dma = -1;
+	if (au1000->stream[CAPTURE ])
+		au1000->stream[CAPTURE ]->dma = -1;
+
 	if (au1000->stream[PLAYBACK] == NULL ||
-	    au1000->stream[CAPTURE] == NULL) {
+	    au1000->stream[CAPTURE ] == NULL) {
 		snd_card_free(card);
 		return -ENOMEM;
 	}




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

end of thread, other threads:[~2006-03-21  0:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-21  0:59 [PATCH] AMD Au1x00: fix DMA init/cleanup Sergei Shtylylov
  -- strict thread matches above, loose matches on Subject: below --
2006-03-20 21:20 Sergei Shtylylov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.