mirror of
https://github.com/torvalds/linux.git
synced 2026-10-11 04:47:02 +02:00
ASoC: aw88261: 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-5-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
dba82cc766
commit
037729f509
|
|
@ -1149,7 +1149,7 @@ static int aw88261_dev_init(struct aw88261 *aw88261, struct aw_container *aw_cfg
|
|||
|
||||
static int aw88261_request_firmware_file(struct aw88261 *aw88261)
|
||||
{
|
||||
const struct firmware *cont = NULL;
|
||||
const struct firmware *cont __free(firmware) = NULL;
|
||||
struct aw_container *aw_cfg;
|
||||
const char *fw_name;
|
||||
int ret;
|
||||
|
|
@ -1169,13 +1169,11 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261)
|
|||
fw_name, cont ? cont->size : 0);
|
||||
|
||||
aw_cfg = devm_kzalloc(aw88261->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);
|
||||
|
||||
aw88261->aw_cfg = aw_cfg;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user