mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-12-04 20:40:55 -06:00
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>
This commit is contained in:
@@ -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 +
|
||||
|
||||
Reference in New Issue
Block a user