ASoC: aw88395: 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-6-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Takashi Iwai 2026-08-06 15:59:37 +02:00 committed by Mark Brown
parent 037729f509
commit d8e40355d9
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -457,7 +457,7 @@ static void aw88395_hw_reset(struct aw88395 *aw88395)
static int aw88395_request_firmware_file(struct aw88395 *aw88395)
{
const struct firmware *cont = NULL;
const struct firmware *cont __free(firmware) = NULL;
struct aw_container *aw_cfg;
int ret;
@ -473,13 +473,11 @@ static int aw88395_request_firmware_file(struct aw88395 *aw88395)
AW88395_ACF_FILE, cont ? cont->size : 0);
aw_cfg = devm_kzalloc(aw88395->aw_pa->dev, struct_size(aw_cfg, data, cont->size), GFP_KERNEL);
if (!aw_cfg) {
release_firmware(cont);
if (!aw_cfg)
return -ENOMEM;
}
aw_cfg->len = (int)cont->size;
memcpy(aw_cfg->data, cont->data, cont->size);
release_firmware(cont);
aw88395->aw_cfg = aw_cfg;