public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: Tegra: tegra_pcm_deallocate_dma_buffer: Don't OOPS
@ 2011-08-04 22:44 Stephen Warren
       [not found] ` <1312497884-1599-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2011-08-08 15:43 ` [PATCH 1/3] ASoC: Tegra: tegra_pcm_deallocate_dma_buffer: Don't OOPS Liam Girdwood
  0 siblings, 2 replies; 7+ messages in thread
From: Stephen Warren @ 2011-08-04 22:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren

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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 sound/soc/tegra/tegra_pcm.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index ff86e5e..c7cfd96 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;
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-09 15:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-04 22:44 [PATCH 1/3] ASoC: Tegra: tegra_pcm_deallocate_dma_buffer: Don't OOPS Stephen Warren
     [not found] ` <1312497884-1599-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-04 22:44   ` [PATCH 2/3] ASoC: Tegra: WM8903: Allow re-insertion of module Stephen Warren
     [not found]     ` <1312497884-1599-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-09  0:43       ` Mark Brown
     [not found]         ` <20110809004346.GA22795-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-08-09 15:36           ` Stephen Warren
     [not found]             ` <74CDBE0F657A3D45AFBB94109FB122FF04A068726C-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-08-09 15:38               ` Mark Brown
2011-08-04 22:44   ` [PATCH 3/3] ASoC: WM8903: Free IRQ on device removal Stephen Warren
2011-08-08 15:43 ` [PATCH 1/3] ASoC: Tegra: tegra_pcm_deallocate_dma_buffer: Don't OOPS Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox