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/blackfin/bf5xx-i2s-pcm.c | |
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/blackfin/bf5xx-i2s-pcm.c')
-rw-r--r-- | sound/soc/blackfin/bf5xx-i2s-pcm.c | 5 |
1 files changed, 2 insertions, 3 deletions
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); | |||
260 | static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) | 260 | static 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) |