summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-pcm.c
diff options
context:
space:
mode:
authorRussell King - ARM Linux2013-10-31 16:09:20 +0100
committerMark Brown2013-10-31 18:57:47 +0100
commit2062b4c5d2d8fa47dc89105464e67a7ba310c9e7 (patch)
tree856c4c93bd37bf0ce331c86323cee00650e0c7a2 /sound/soc/soc-pcm.c
parentASoC: pcm: Check for ops before deferencing them (diff)
downloadkernel-qcow2-linux-2062b4c5d2d8fa47dc89105464e67a7ba310c9e7.tar.gz
kernel-qcow2-linux-2062b4c5d2d8fa47dc89105464e67a7ba310c9e7.tar.xz
kernel-qcow2-linux-2062b4c5d2d8fa47dc89105464e67a7ba310c9e7.zip
ASoC: dpcm: improve robustness
Avoid oopsing if there is no backend stream associated with a front end stream. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-pcm.c')
-rw-r--r--sound/soc/soc-pcm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d81b79251760..591f0f3074c5 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1038,6 +1038,12 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
struct snd_pcm_substream *be_substream =
snd_soc_dpcm_get_substream(be, stream);
+ if (!be_substream) {
+ dev_err(be->dev, "ASoC: no backend %s stream\n",
+ stream ? "capture" : "playback");
+ continue;
+ }
+
/* is this op for this BE ? */
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
continue;
@@ -1055,7 +1061,8 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE))
continue;
- dev_dbg(be->dev, "ASoC: open BE %s\n", be->dai_link->name);
+ dev_dbg(be->dev, "ASoC: open %s BE %s\n",
+ stream ? "capture" : "playback", be->dai_link->name);
be_substream->runtime = be->dpcm[stream].runtime;
err = soc_pcm_open(be_substream);