diff options
author | Joachim Eastwood <joachim.eastwood@jotron.com> | 2011-12-31 19:58:44 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-07 14:18:05 -0500 |
commit | 25e9e7565f9aa9e4b976387a3fab60bfaa4efac8 (patch) | |
tree | 4a937cd72ecbd52980d09799aab0092a0f1bb4b8 /sound/soc/atmel | |
parent | 739be96ab83755e10fd0c2b6a34c8a73254527f7 (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/atmel')
-rw-r--r-- | sound/soc/atmel/atmel-pcm.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c index 60de05525c06..a21ff459e5d3 100644 --- a/sound/soc/atmel/atmel-pcm.c +++ b/sound/soc/atmel/atmel-pcm.c | |||
@@ -367,7 +367,6 @@ static u64 atmel_pcm_dmamask = 0xffffffff; | |||
367 | static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) | 367 | static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) |
368 | { | 368 | { |
369 | struct snd_card *card = rtd->card->snd_card; | 369 | struct snd_card *card = rtd->card->snd_card; |
370 | struct snd_soc_dai *dai = rtd->cpu_dai; | ||
371 | struct snd_pcm *pcm = rtd->pcm; | 370 | struct snd_pcm *pcm = rtd->pcm; |
372 | int ret = 0; | 371 | int ret = 0; |
373 | 372 | ||
@@ -376,14 +375,14 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
376 | if (!card->dev->coherent_dma_mask) | 375 | if (!card->dev->coherent_dma_mask) |
377 | card->dev->coherent_dma_mask = 0xffffffff; | 376 | card->dev->coherent_dma_mask = 0xffffffff; |
378 | 377 | ||
379 | if (dai->driver->playback.channels_min) { | 378 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { |
380 | ret = atmel_pcm_preallocate_dma_buffer(pcm, | 379 | ret = atmel_pcm_preallocate_dma_buffer(pcm, |
381 | SNDRV_PCM_STREAM_PLAYBACK); | 380 | SNDRV_PCM_STREAM_PLAYBACK); |
382 | if (ret) | 381 | if (ret) |
383 | goto out; | 382 | goto out; |
384 | } | 383 | } |
385 | 384 | ||
386 | if (dai->driver->capture.channels_min) { | 385 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { |
387 | pr_debug("atmel-pcm:" | 386 | pr_debug("atmel-pcm:" |
388 | "Allocating PCM capture DMA buffer\n"); | 387 | "Allocating PCM capture DMA buffer\n"); |
389 | ret = atmel_pcm_preallocate_dma_buffer(pcm, | 388 | ret = atmel_pcm_preallocate_dma_buffer(pcm, |