ASoC: aw87390: 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/20260806140006.1412298-2-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Takashi Iwai 2026-08-06 15:59:33 +02:00 committed by Mark Brown
parent d4c669890e
commit 3eea69748a
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -248,7 +248,7 @@ static const struct snd_kcontrol_new aw87390_controls[] = {
static int aw87390_request_firmware_file(struct aw87390 *aw87390)
{
const struct firmware *cont = NULL;
const struct firmware *cont __free(firmware) = NULL;
int ret;
aw87390->aw_pa->fw_status = AW87390_DEV_FW_FAILED;
@ -263,14 +263,11 @@ static int aw87390_request_firmware_file(struct aw87390 *aw87390)
aw87390->aw_cfg = devm_kzalloc(aw87390->aw_pa->dev,
struct_size(aw87390->aw_cfg, data, cont->size), GFP_KERNEL);
if (!aw87390->aw_cfg) {
release_firmware(cont);
if (!aw87390->aw_cfg)
return -ENOMEM;
}
aw87390->aw_cfg->len = cont->size;
memcpy(aw87390->aw_cfg->data, cont->data, cont->size);
release_firmware(cont);
ret = aw88395_dev_load_acf_check(aw87390->aw_pa, aw87390->aw_cfg);
if (ret) {