mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
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>
This commit is contained in:
parent
c5914b0aae
commit
2062b4c5d2
1 changed files with 8 additions and 1 deletions
|
@ -1038,6 +1038,12 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
||||||
struct snd_pcm_substream *be_substream =
|
struct snd_pcm_substream *be_substream =
|
||||||
snd_soc_dpcm_get_substream(be, stream);
|
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 ? */
|
/* is this op for this BE ? */
|
||||||
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
||||||
continue;
|
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))
|
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE))
|
||||||
continue;
|
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;
|
be_substream->runtime = be->dpcm[stream].runtime;
|
||||||
err = soc_pcm_open(be_substream);
|
err = soc_pcm_open(be_substream);
|
||||||
|
|
Loading…
Reference in a new issue