ALSA: sscape: 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-8-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2026-07-29 10:37:25 +02:00
parent 185841c94a
commit 0585a0c7ab

View File

@ -526,7 +526,7 @@ static int upload_dma_data(struct soundscape *s, const unsigned char *data,
static int sscape_upload_bootblock(struct snd_card *card)
{
struct soundscape *sscape = get_card_soundscape(card);
const struct firmware *init_fw = NULL;
const struct firmware *init_fw __free(firmware) = NULL;
int data = 0;
int ret;
@ -537,8 +537,6 @@ static int sscape_upload_bootblock(struct snd_card *card)
}
ret = upload_dma_data(sscape, init_fw->data, init_fw->size);
release_firmware(init_fw);
guard(spinlock_irqsave)(&sscape->lock);
if (ret == 0)
data = host_read_ctrl_unsafe(sscape->io_base, 100);
@ -562,7 +560,7 @@ static int sscape_upload_bootblock(struct snd_card *card)
static int sscape_upload_microcode(struct snd_card *card, int version)
{
struct soundscape *sscape = get_card_soundscape(card);
const struct firmware *init_fw = NULL;
const struct firmware *init_fw __free(firmware) = NULL;
char name[14];
int err;
@ -579,8 +577,6 @@ static int sscape_upload_microcode(struct snd_card *card, int version)
dev_info(card->dev, "sscape: MIDI firmware loaded %zu KBs\n",
init_fw->size >> 10);
release_firmware(init_fw);
return err;
}