ALSA: sh: Use auto-cleanup for firmware loading

Simplify the code to manage the firmware loading with __free(firmware)
auto-cleanup.

Only the code refactoring, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260729083735.120219-15-tiwai@suse.de
This commit is contained in:
Takashi Iwai
2026-07-29 10:37:32 +02:00
parent 26c602eea1
commit cefb2f905b

View File

@@ -518,8 +518,9 @@ static const struct snd_kcontrol_new snd_aica_pcmvolume_control = {
static int load_aica_firmware(void)
{
int err;
const struct firmware *fw_entry;
spu_reset();
const struct firmware *fw_entry __free(firmware) = NULL;
err = request_firmware(&fw_entry, "aica_firmware.bin", &pd->dev);
if (unlikely(err))
return err;
@@ -527,7 +528,6 @@ static int load_aica_firmware(void)
spu_disable();
spu_memload(0, fw_entry->data, fw_entry->size);
spu_enable();
release_firmware(fw_entry);
return err;
}