Re: [PATCH 1/2] ALSA: hda: cs35l56: Free ACPI _SUB string on errors

From: Richard Fitzgerald

Date: Wed May 20 2026 - 08:56:49 EST


On 20/05/2026 1:48 pm, Cássio Gabriel wrote:
cs35l56_hda_read_acpi() gets an allocated ACPI _SUB string from
acpi_get_subsystem_id(). On success, that string is either transferred
to cs35l56->system_name or freed after constructing a speaker-ID-specific
firmware name.

Several error paths after the _SUB lookup return without releasing the
allocated string. This includes speaker ID lookup errors other than
-ENOENT, and errors after _SUB is read but before ownership is
transferred to cs35l56->system_name.

Free the temporary _SUB string on those error paths. If ownership has
already been transferred to cs35l56->system_name, free that member and
clear it before returning the error.

Fixes: 6f03b446cbae ("ALSA: hda: cs35l56: Add support for speaker id")
Fixes: 40b1c2f9b299 ("ALSA: hda/cs35l56: Workaround bad dev-index on Lenovo Yoga Book 9i GenX")
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@xxxxxxxxx>
---

__free(kfree) would be simpler.