aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.10/0146-fixes-a-bug-in-the-snd-bcm2835-driver.patch
blob: 16a5a6d1e94b8352f2f376bb5fe61c6e46c9431a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From bd15c8ebc85f89b3e3c464a628f70ea4b144377f Mon Sep 17 00:00:00 2001
From: Janis Danisevskis <werwurm@snafu.de>
Date: Wed, 1 Jan 2014 18:41:53 +0100
Subject: [PATCH 146/196] fixes a bug in the snd-bcm2835 driver

The "instance" field of bcm2835_alsa_stream_t may be accessed uninitialized
by bcm2835_audio_set_ctls_chan if called during stream creation. This fix
deferres the addition to of the stream to chip untill it has been fully
initialized.
---
 sound/arm/bcm2835-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c
index 21e435b..499e225 100755
--- a/sound/arm/bcm2835-pcm.c
+++ b/sound/arm/bcm2835-pcm.c
@@ -127,7 +127,6 @@ static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream)
 	alsa_stream->chip = chip;
 	alsa_stream->substream = substream;
 	alsa_stream->idx = idx;
-	chip->alsa_stream[idx] = alsa_stream;
 
 	sema_init(&alsa_stream->buffers_update_sem, 0);
 	sema_init(&alsa_stream->control_sem, 0);
@@ -149,6 +148,7 @@ static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream)
 		kfree(alsa_stream);
 		return err;
 	}
+	chip->alsa_stream[idx] = alsa_stream;
 
 	alsa_stream->open = 1;
 	alsa_stream->draining = 1;
-- 
1.9.1