ASoC: aw88399: Use auto-cleanup for firmware loading

Simplify the code to manage the firmware loading with __free(firmware)
auto-cleanup.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260806140006.1412298-7-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Takashi Iwai 2026-08-06 15:59:38 +02:00 committed by Mark Brown
parent d8e40355d9
commit 1767b85125
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1282,7 +1282,7 @@ static int aw88399_dev_init(struct aw88399 *aw88399, struct aw_container *aw_cfg
int aw88399_request_firmware_file(struct aw88399 *aw88399)
{
const struct firmware *cont = NULL;
const struct firmware *cont __free(firmware) = NULL;
int ret;
aw88399->aw_pa->fw_status = AW88399_DEV_FW_FAILED;
@ -1298,13 +1298,11 @@ int aw88399_request_firmware_file(struct aw88399 *aw88399)
aw88399->aw_cfg = devm_kzalloc(aw88399->aw_pa->dev,
struct_size(aw88399->aw_cfg, data, cont->size), GFP_KERNEL);
if (!aw88399->aw_cfg) {
release_firmware(cont);
if (!aw88399->aw_cfg)
return -ENOMEM;
}
aw88399->aw_cfg->len = (int)cont->size;
memcpy(aw88399->aw_cfg->data, cont->data, cont->size);
release_firmware(cont);
ret = aw88395_dev_load_acf_check(aw88399->aw_pa, aw88399->aw_cfg);
if (ret) {