[PATCH 07/14] ALSA: sscape: Use auto-cleanup for firmware loading

Takashi Iwai <[email protected]>
Newsgroups org.kernel.vger.linux-sound
Message-ID <[email protected]>
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 <[email protected]>
---
 sound/isa/sscape.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index ce8a59650e38..9b615b588cdf 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -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;
 }
 
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.