Skip to content

Commit

Permalink
ASoC: Tegra: tegra_pcm_deallocate_dma_buffer: Don't OOPS
Browse files Browse the repository at this point in the history
Not all PCM devices have all sub-streams. Specifically, the SPDIF driver
only supports playback and hence has no capture substream. Check whether
a substream exists before dereferencing it, when de-allocating DMA
buffers in tegra_pcm_deallocate_dma_buffer.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
  • Loading branch information
Stephen Warren authored and Mark Brown committed Aug 9, 2011
1 parent 7cb0aa2 commit a96edd5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sound/soc/tegra/tegra_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,14 @@ static int tegra_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)

static void tegra_pcm_deallocate_dma_buffer(struct snd_pcm *pcm, int stream)
{
struct snd_pcm_substream *substream = pcm->streams[stream].substream;
struct snd_dma_buffer *buf = &substream->dma_buffer;
struct snd_pcm_substream *substream;
struct snd_dma_buffer *buf;

substream = pcm->streams[stream].substream;
if (!substream)
return;

buf = &substream->dma_buffer;
if (!buf->area)
return;

Expand Down

0 comments on commit a96edd5

Please sign in to comment.