[PATCH 14/14] ALSA: sh: 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/sh/aica.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 8196e1bf0416..078fc7fc08f9 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -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;
 }
 
-- 
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.