* [PATCH] ASoC: soc-core: Pre-check zero CPU/codec DAIs, handle early rtd->dais alloc failure
@ 2025-11-19 10:11 jempty.liang
2025-11-19 15:30 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: jempty.liang @ 2025-11-19 10:11 UTC (permalink / raw)
To: lgirdwood, broonie, perex; +Cc: linux-sound, linux-kernel, jempty.liang
This commit adds a pre-check in ASoC to ensure there are non-zero CPU or
codec DAIs. It also handles early failure of memory allocation for
rtd->dais by going to the cleanup path, preventing potential issues
from invalid configurations or out-of-memory situations.
Signed-off-by: jempty.liang <imntjempty@163.com>
---
sound/soc/soc-core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4297cc27005c..e4b21bf39e59 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -545,6 +545,11 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
dev_set_drvdata(dev, rtd);
INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
+ if ((dai_link->num_cpus + dai_link->num_codecs) == 0) {
+ dev_err(dev, "ASoC: it has no CPU or codec DAIs\n");
+ goto free_rtd;
+ }
+
/*
* for rtd->dais
*/
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: soc-core: Pre-check zero CPU/codec DAIs, handle early rtd->dais alloc failure
2025-11-19 10:11 [PATCH] ASoC: soc-core: Pre-check zero CPU/codec DAIs, handle early rtd->dais alloc failure jempty.liang
@ 2025-11-19 15:30 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-11-19 15:30 UTC (permalink / raw)
To: lgirdwood, perex, jempty.liang; +Cc: linux-sound, linux-kernel
On Wed, 19 Nov 2025 10:11:16 +0000, jempty.liang wrote:
> This commit adds a pre-check in ASoC to ensure there are non-zero CPU or
> codec DAIs. It also handles early failure of memory allocation for
> rtd->dais by going to the cleanup path, preventing potential issues
> from invalid configurations or out-of-memory situations.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: soc-core: Pre-check zero CPU/codec DAIs, handle early rtd->dais alloc failure
commit: e2c48498a93404743e0565dcac29450fec02e6a3
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-19 15:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 10:11 [PATCH] ASoC: soc-core: Pre-check zero CPU/codec DAIs, handle early rtd->dais alloc failure jempty.liang
2025-11-19 15:30 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox