ASoC: dpcm: improve robustness
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
@@ -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
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_substreamwhen writingbe_substream->runtimeif the frontend is marked as having a playback/capture stream but there is no backend.
Applied, thanks.