summaryrefslogtreecommitdiff
path: root/sound/hda
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2026-09-02 10:18:06 +0200
committerMark Brown <broonie@kernel.org>2026-09-03 22:51:26 +0100
commit48afc07c4f1b9c3cdbe66ddc3e7677ed395ce75f (patch)
tree47a54e0fda518b4ccd806d5fdfbdb88e4db970fa /sound/hda
parent35af118326b22d840a3be271daa080728844cc4d (diff)
ALSA: hda: ext: Clean up streams if their initialization fails
snd_hdac_ext_stream_init_all() does not rollback changes done when the allocation fails. Fix that to simplify its usage. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Acked-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260902081814.1590883-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/hda')
-rw-r--r--sound/hda/core/ext/stream.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/hda/core/ext/stream.c b/sound/hda/core/ext/stream.c
index 517bd151fcc3..1f96e0484660 100644
--- a/sound/hda/core/ext/stream.c
+++ b/sound/hda/core/ext/stream.c
@@ -102,8 +102,10 @@ int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
for (i = 0; i < num_stream; i++) {
struct hdac_ext_stream *hext_stream = kzalloc_obj(*hext_stream);
- if (!hext_stream)
+ if (!hext_stream) {
+ snd_hdac_ext_stream_free_all(bus);
return -ENOMEM;
+ }
tag = ++stream_tag;
snd_hdac_ext_stream_init(bus, hext_stream, idx, dir, tag);
idx++;
@@ -111,7 +113,6 @@ int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
}
return 0;
-
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init_all);