summaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra/tegra_pcm.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-08-05 00:44:42 +0200
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-09 02:40:57 +0200
commita96edd59b2bc88b3d1ea47e0ba48076d65db9302 (patch)
treeb6c1ac738bd363db83e2ac7ec990474170591450 /sound/soc/tegra/tegra_pcm.c
parentMerge branch 'fix/asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwa... (diff)
downloadlinux-a96edd59b2bc88b3d1ea47e0ba48076d65db9302.tar.xz
linux-a96edd59b2bc88b3d1ea47e0ba48076d65db9302.zip
ASoC: Tegra: tegra_pcm_deallocate_dma_buffer: Don't OOPS
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
Diffstat (limited to 'sound/soc/tegra/tegra_pcm.c')
-rw-r--r--sound/soc/tegra/tegra_pcm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index ff86e5e3db68..c7cfd96e991e 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -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;