summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2026-09-02 10:18:05 +0200
committerMark Brown <broonie@kernel.org>2026-09-03 22:51:24 +0100
commit35af118326b22d840a3be271daa080728844cc4d (patch)
treeaf5019b25f3db56810b8fef215ba58555a995766
parentcee9395acd8043be0644b25c34bfa86623f2b935 (diff)
downloadlinux-next-35af118326b22d840a3be271daa080728844cc4d.tar.gz
linux-next-35af118326b22d840a3be271daa080728844cc4d.zip
ALSA: hda: ext: Clean up links if their initialization fails
snd_hdac_ext_bus_get_ml_capabilities() allocates the hlink nodes one-by-one but the procedure may fails due to -ENOMEM in the middle of it. Clean up the list before returning the error code to simply the function usage. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20260902081814.1590883-2-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/hda/core/ext/controller.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/hda/core/ext/controller.c b/sound/hda/core/ext/controller.c
index b1f1eff1d181..6d0af7e6f63c 100644
--- a/sound/hda/core/ext/controller.c
+++ b/sound/hda/core/ext/controller.c
@@ -90,8 +90,10 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus)
for (idx = 0; idx < link_count; idx++) {
hlink = kzalloc_obj(*hlink);
- if (!hlink)
+ if (!hlink) {
+ snd_hdac_ext_link_free_all(bus);
return -ENOMEM;
+ }
hlink->index = idx;
hlink->bus = bus;
hlink->ml_addr = bus->mlcap + AZX_ML_BASE +