aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-pcm.c
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/omap/omap-pcm.c
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/omap/omap-pcm.c')
-rw-r--r--sound/soc/omap/omap-pcm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 52a0f634948e..a59bd352d342 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -378,7 +378,6 @@ static void omap_pcm_free_dma_buffers(struct snd_pcm *pcm)
378static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) 378static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
379{ 379{
380 struct snd_card *card = rtd->card->snd_card; 380 struct snd_card *card = rtd->card->snd_card;
381 struct snd_soc_dai *dai = rtd->cpu_dai;
382 struct snd_pcm *pcm = rtd->pcm; 381 struct snd_pcm *pcm = rtd->pcm;
383 int ret = 0; 382 int ret = 0;
384 383
@@ -387,14 +386,14 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
387 if (!card->dev->coherent_dma_mask) 386 if (!card->dev->coherent_dma_mask)
388 card->dev->coherent_dma_mask = DMA_BIT_MASK(64); 387 card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
389 388
390 if (dai->driver->playback.channels_min) { 389 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
391 ret = omap_pcm_preallocate_dma_buffer(pcm, 390 ret = omap_pcm_preallocate_dma_buffer(pcm,
392 SNDRV_PCM_STREAM_PLAYBACK); 391 SNDRV_PCM_STREAM_PLAYBACK);
393 if (ret) 392 if (ret)
394 goto out; 393 goto out;
395 } 394 }
396 395
397 if (dai->driver->capture.channels_min) { 396 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
398 ret = omap_pcm_preallocate_dma_buffer(pcm, 397 ret = omap_pcm_preallocate_dma_buffer(pcm,
399 SNDRV_PCM_STREAM_CAPTURE); 398 SNDRV_PCM_STREAM_CAPTURE);
400 if (ret) 399 if (ret)