mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-12-04 21:10:57 -06:00
ASoC: aw88081: 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-3-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -1133,7 +1133,7 @@ static int aw88081_dev_init(struct aw88081 *aw88081, struct aw_container *aw_cfg
|
||||
|
||||
static int aw88081_request_firmware_file(struct aw88081 *aw88081)
|
||||
{
|
||||
const struct firmware *cont = NULL;
|
||||
const struct firmware *cont __free(firmware) = NULL;
|
||||
struct aw_container *aw_cfg;
|
||||
int ret;
|
||||
|
||||
@@ -1147,17 +1147,14 @@ static int aw88081_request_firmware_file(struct aw88081 *aw88081)
|
||||
AW88081_ACF_FILE, cont ? cont->size : 0);
|
||||
|
||||
aw_cfg = devm_kzalloc(aw88081->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);
|
||||
|
||||
aw88081->aw_cfg = aw_cfg;
|
||||
|
||||
release_firmware(cont);
|
||||
|
||||
ret = aw88395_dev_load_acf_check(aw88081->aw_pa, aw88081->aw_cfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user