Skip to content

Commit 59a4d9a

Browse files
crojewsk-intelbroonie
authored andcommitted
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>
1 parent 9adf2de commit 59a4d9a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

sound/soc/soc-pcm.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,17 +2510,6 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
25102510

25112511
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
25122512

2513-
/* there is no point preparing this FE if there are no BEs */
2514-
if (list_empty(&fe->dpcm[stream].be_clients)) {
2515-
/* dev_err_once() for visibility, dev_dbg() for debugging UCM profiles */
2516-
dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based routing or UCM profile\n",
2517-
fe->dai_link->name);
2518-
dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
2519-
fe->dai_link->name);
2520-
ret = -EINVAL;
2521-
goto out;
2522-
}
2523-
25242513
ret = dpcm_be_dai_prepare(fe, stream);
25252514
if (ret < 0)
25262515
goto out;
@@ -2776,11 +2765,23 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
27762765
/* calculate valid and active FE <-> BE dpcms */
27772766
dpcm_add_paths(fe, stream, &list);
27782767

2768+
/* There is no point starting up this FE if there are no BEs. */
2769+
if (list_empty(&fe->dpcm[stream].be_clients)) {
2770+
/* dev_err_once() for visibility, dev_dbg() for debugging UCM profiles. */
2771+
dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based routing or UCM profile\n",
2772+
fe->dai_link->name);
2773+
dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n", fe->dai_link->name);
2774+
2775+
ret = -EINVAL;
2776+
goto put_path;
2777+
}
2778+
27792779
ret = dpcm_fe_dai_startup(fe_substream);
27802780
if (ret < 0)
27812781
dpcm_fe_dai_cleanup(fe_substream);
27822782

27832783
dpcm_clear_pending_state(fe, stream);
2784+
put_path:
27842785
dpcm_path_put(&list);
27852786
open_end:
27862787
snd_soc_dpcm_mutex_unlock(fe);

0 commit comments

Comments
 (0)