Skip to contentSkip to conversation

ASoC: dpcm: improve robustness

PATCH Applied Russell King - ARM Linux 2 participants 2 messages Oct 31, 2013 – Nov 1, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: dpcm: improve robustness

Mark, Liam,

You may also wish to consider adding this patch as well - it avoids oopsing due to a NULL be_substream when writing be_substream->runtime if the frontend is marked as having a playback/capture stream but there is no backend.

I found this with Liam's "Explicitly set capture/playback support in DAI links" patch applied, and I'd configured the FE to have both capture and playback, but I'd forgotten to configure the BE appropriately. It seems nicer to gracefully handle this than oops the kernel.

8<=====
From: Russell King <[email protected]>
ASoC: dpcm: improve robustness

Avoid oopsing if there is no backend stream associated with a front end stream.

---
 sound/soc/soc-pcm.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
sound/soc/soc-pcm.c +8 -1
index 7798072c45ea..419af79fa30e 100644
@@ -1036,6 +1036,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;
@@ -1053,7 +1059,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);
Signature · 1 line
1.7.4.4
maintainer Applied
#1 lore raw
Quoted 6 lines · Russell King - ARM Linux

Mark, Liam,

You may also wish to consider adding this patch as well - it avoids oopsing due to a NULL be_substream when writing be_substream->runtime if the frontend is marked as having a playback/capture stream but there is no backend.

Applied, thanks.