[PATCH v2 21/31] ASoC: tlv320aic31xx: 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.

Cc: Shenghao Ding <[email protected]>
Cc: Kevin Lu <[email protected]>
Cc: Baojun Xu <[email protected]>
Cc: Sen Wang <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
---
 sound/soc/codecs/tlv320aic31xx.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 1d2e0ea6d4fe..43bcbc5449e1 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1720,18 +1720,14 @@ static int tlv320dac3100_fw_load(struct aic31xx_priv *aic31xx,
 static int tlv320dac3100_load_coeffs(struct aic31xx_priv *aic31xx,
 				     const char *fw_name)
 {
-	const struct firmware *fw;
+	const struct firmware *fw __free(firmware) = NULL;
 	int ret;
 
 	ret = request_firmware(&fw, fw_name, aic31xx->dev);
 	if (ret)
 		return ret;
 
-	ret = tlv320dac3100_fw_load(aic31xx, fw->data, fw->size);
-
-	release_firmware(fw);
-
-	return ret;
+	return tlv320dac3100_fw_load(aic31xx, fw->data, fw->size);
 }
 
 static int aic31xx_i2c_probe(struct i2c_client *i2c)
-- 
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.