summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2025-05-30 16:12:31 +0200
committerMark Brown <broonie@kernel.org>2025-06-02 12:27:42 +0100
commit59a4d9a9efd921ae2b722ffa52217124bcbc0acf (patch)
tree0e181250b4ffad4f7a869faad1219b278f39c40b
parent9adf2de86611ac108d07e769a699556d87f052e2 (diff)
ASoC: pcm: Do not open FEs with no BEs connected
The check is performed in prepare-step, that is dpcm_fe_dai_prepare() but that is very late - code operates on invalid configuration from dpcm_fe_dai_open() till it gets there. Relocate the check to the open-step to avoid any invalid scenarios. Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20250530141231.2943351-1-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-pcm.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 43835197d1fe..2c21fd528afd 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2510,17 +2510,6 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
- /* there is no point preparing this FE if there are no BEs */
- if (list_empty(&fe->dpcm[stream].be_clients)) {
- /* dev_err_once() for visibility, dev_dbg() for debugging UCM profiles */
- dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based routing or UCM profile\n",
- fe->dai_link->name);
- dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
- fe->dai_link->name);
- ret = -EINVAL;
- goto out;
- }
-
ret = dpcm_be_dai_prepare(fe, stream);
if (ret < 0)
goto out;
@@ -2776,11 +2765,23 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
/* calculate valid and active FE <-> BE dpcms */
dpcm_add_paths(fe, stream, &list);
+ /* There is no point starting up this FE if there are no BEs. */
+ if (list_empty(&fe->dpcm[stream].be_clients)) {
+ /* dev_err_once() for visibility, dev_dbg() for debugging UCM profiles. */
+ dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based routing or UCM profile\n",
+ fe->dai_link->name);
+ dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n", fe->dai_link->name);
+
+ ret = -EINVAL;
+ goto put_path;
+ }
+
ret = dpcm_fe_dai_startup(fe_substream);
if (ret < 0)
dpcm_fe_dai_cleanup(fe_substream);
dpcm_clear_pending_state(fe, stream);
+put_path:
dpcm_path_put(&list);
open_end:
snd_soc_dpcm_mutex_unlock(fe);