aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin
diff options
context:
space:
mode:
authorJoachim Eastwood <joachim.eastwood@jotron.com>2011-12-31 19:58:44 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-07 14:18:05 -0500
commit25e9e7565f9aa9e4b976387a3fab60bfaa4efac8 (patch)
tree4a937cd72ecbd52980d09799aab0092a0f1bb4b8 /sound/soc/blackfin
parent739be96ab83755e10fd0c2b6a34c8a73254527f7 (diff)
ASoC: check for substream not channels_min in pcm engines
This is a follow up on 53dea36c70c1857 which fixes the other affected pcm engines. Description from 53dea36c70c1857: Don't rely on the codec's channels_min information to decide wheter or not allocate a substream's DMA buffer. Rather check if the substream itself was allocated previously. Without this patch I was seeing null-pointer dereferenc in atmel-pcm. Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/blackfin')
-rw-r--r--sound/soc/blackfin/bf5xx-ac97-pcm.c5
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c5
-rw-r--r--sound/soc/blackfin/bf5xx-tdm-pcm.c5
3 files changed, 6 insertions, 9 deletions
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c
index fcff58390848..d7dc9bde0976 100644
--- a/sound/soc/blackfin/bf5xx-ac97-pcm.c
+++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c
@@ -421,7 +421,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
421static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) 421static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
422{ 422{
423 struct snd_card *card = rtd->card->snd_card; 423 struct snd_card *card = rtd->card->snd_card;
424 struct snd_soc_dai *dai = rtd->cpu_dai;
425 struct snd_pcm *pcm = rtd->pcm; 424 struct snd_pcm *pcm = rtd->pcm;
426 int ret = 0; 425 int ret = 0;
427 426
@@ -431,14 +430,14 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
431 if (!card->dev->coherent_dma_mask) 430 if (!card->dev->coherent_dma_mask)
432 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 431 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
433 432
434 if (dai->driver->playback.channels_min) { 433 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
435 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 434 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
436 SNDRV_PCM_STREAM_PLAYBACK); 435 SNDRV_PCM_STREAM_PLAYBACK);
437 if (ret) 436 if (ret)
438 goto out; 437 goto out;
439 } 438 }
440 439
441 if (dai->driver->capture.channels_min) { 440 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
442 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 441 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
443 SNDRV_PCM_STREAM_CAPTURE); 442 SNDRV_PCM_STREAM_CAPTURE);
444 if (ret) 443 if (ret)
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index 6ec3d41b9b6d..63205d723eab 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c
@@ -260,7 +260,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
260static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) 260static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
261{ 261{
262 struct snd_card *card = rtd->card->snd_card; 262 struct snd_card *card = rtd->card->snd_card;
263 struct snd_soc_dai *dai = rtd->cpu_dai;
264 struct snd_pcm *pcm = rtd->pcm; 263 struct snd_pcm *pcm = rtd->pcm;
265 int ret = 0; 264 int ret = 0;
266 265
@@ -270,14 +269,14 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
270 if (!card->dev->coherent_dma_mask) 269 if (!card->dev->coherent_dma_mask)
271 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 270 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
272 271
273 if (dai->driver->playback.channels_min) { 272 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
274 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 273 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
275 SNDRV_PCM_STREAM_PLAYBACK); 274 SNDRV_PCM_STREAM_PLAYBACK);
276 if (ret) 275 if (ret)
277 goto out; 276 goto out;
278 } 277 }
279 278
280 if (dai->driver->capture.channels_min) { 279 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
281 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 280 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
282 SNDRV_PCM_STREAM_CAPTURE); 281 SNDRV_PCM_STREAM_CAPTURE);
283 if (ret) 282 if (ret)
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c
index 4406f9a865ae..254490cf1876 100644
--- a/sound/soc/blackfin/bf5xx-tdm-pcm.c
+++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c
@@ -286,7 +286,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
286static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) 286static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
287{ 287{
288 struct snd_card *card = rtd->card->snd_card; 288 struct snd_card *card = rtd->card->snd_card;
289 struct snd_soc_dai *dai = rtd->cpu_dai;
290 struct snd_pcm *pcm = rtd->pcm; 289 struct snd_pcm *pcm = rtd->pcm;
291 int ret = 0; 290 int ret = 0;
292 291
@@ -295,14 +294,14 @@ static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
295 if (!card->dev->coherent_dma_mask) 294 if (!card->dev->coherent_dma_mask)
296 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 295 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
297 296
298 if (dai->driver->playback.channels_min) { 297 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
299 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 298 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
300 SNDRV_PCM_STREAM_PLAYBACK); 299 SNDRV_PCM_STREAM_PLAYBACK);
301 if (ret) 300 if (ret)
302 goto out; 301 goto out;
303 } 302 }
304 303
305 if (dai->driver->capture.channels_min) { 304 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
306 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 305 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
307 SNDRV_PCM_STREAM_CAPTURE); 306 SNDRV_PCM_STREAM_CAPTURE);
308 if (ret) 307 if (ret)