mirror of
https://github.com/torvalds/linux.git
synced 2026-10-08 11:36:02 +02:00
ASoC: rt722-sdca: Use auto-cleanup for firmware loading
Simplify the code to manage the firmware loading with __free(firmware) auto-cleanup, as well as the firmware file name being released with __free(kfree). Only the code refactoring, no functional changes. Cc: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260806140006.1412298-17-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0582725c6b
commit
d8c1349720
|
|
@ -352,8 +352,6 @@ static int rt722_cae_load(struct rt722_sdca_priv *rt722)
|
|||
static const char func_tag[] = "FUNC";
|
||||
static const char xu_tag[] = "XU";
|
||||
const char *dmi_vendor, *dmi_product, *dmi_sku;
|
||||
char *cae_filename;
|
||||
const struct firmware *cae_fw = NULL;
|
||||
unsigned int cae_st_spk, cae_st_hp, cae_st_mic;
|
||||
unsigned int func, value;
|
||||
unsigned int combined_val;
|
||||
|
|
@ -385,7 +383,8 @@ static int rt722_cae_load(struct rt722_sdca_priv *rt722)
|
|||
space = strchr(dmi_sku, ' ');
|
||||
s_len = space ? space - dmi_sku : strlen(dmi_sku);
|
||||
|
||||
cae_filename = kasprintf(GFP_KERNEL,
|
||||
char *cae_filename __free(kfree) =
|
||||
kasprintf(GFP_KERNEL,
|
||||
"realtek/rt722/rt722_RAE_%.*s_%.*s_%.*s.dat",
|
||||
v_len, dmi_vendor,
|
||||
p_len, dmi_product,
|
||||
|
|
@ -399,8 +398,8 @@ static int rt722_cae_load(struct rt722_sdca_priv *rt722)
|
|||
regmap_write(rt722->regmap, RT722_MIC_CAE_PARAM39, 0x5f);
|
||||
usleep_range(50000, 60000);
|
||||
|
||||
const struct firmware *cae_fw __free(firmware) = NULL;
|
||||
request_firmware(&cae_fw, cae_filename, dev);
|
||||
kfree(cae_filename);
|
||||
if (!cae_fw) {
|
||||
dev_err(dev, "%s: Failed to load CAE firmware\n", __func__);
|
||||
return -ENOENT;
|
||||
|
|
@ -555,7 +554,6 @@ static int rt722_cae_load(struct rt722_sdca_priv *rt722)
|
|||
regcache_cache_bypass(rt722->regmap, false);
|
||||
rt722->cae_update_done = 1;
|
||||
dev_dbg(dev, "%s: CAE FW update done.\n", __func__);
|
||||
release_firmware(cae_fw);
|
||||
return 0;
|
||||
|
||||
verify_abort:
|
||||
|
|
@ -565,7 +563,6 @@ static int rt722_cae_load(struct rt722_sdca_priv *rt722)
|
|||
out_release:
|
||||
rt722_sdca_index_update_bits(rt722, RT722_VENDOR_REG,
|
||||
RT722_MISC_CTRL1, 0x8000, 0x0000);
|
||||
release_firmware(cae_fw);
|
||||
dev_err(dev, "%s: CAE FW update aborted (ret=%d).\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user