mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
ASoC: fsl: 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. Cc: Shengjiu Wang <shengjiu.wang@gmail.com> Cc: Xiubo Li <Xiubo.Lee@gmail.com> Cc: Fabio Estevam <festevam@gmail.com> Cc: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260806140006.1412298-26-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
b6ba77dfeb
commit
997261a59b
|
|
@ -921,10 +921,10 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
|
|||
static int fsl_xcvr_load_firmware(struct fsl_xcvr *xcvr)
|
||||
{
|
||||
struct device *dev = &xcvr->pdev->dev;
|
||||
const struct firmware *fw;
|
||||
int ret = 0, rem, off, out, page = 0, size = FSL_XCVR_REG_OFFSET;
|
||||
u32 mask, val;
|
||||
|
||||
const struct firmware *fw __free(firmware) = NULL;
|
||||
ret = request_firmware(&fw, xcvr->soc_data->fw_name, dev);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to request firmware.\n");
|
||||
|
|
@ -936,7 +936,6 @@ static int fsl_xcvr_load_firmware(struct fsl_xcvr *xcvr)
|
|||
/* RAM is 20KiB = 16KiB code + 4KiB data => max 10 pages 2KiB each */
|
||||
if (rem > 16384) {
|
||||
dev_err(dev, "FW size %d is bigger than 16KiB.\n", rem);
|
||||
release_firmware(fw);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
@ -947,7 +946,7 @@ static int fsl_xcvr_load_firmware(struct fsl_xcvr *xcvr)
|
|||
if (ret < 0) {
|
||||
dev_err(dev, "FW: failed to set page %d, err=%d\n",
|
||||
page, ret);
|
||||
goto err_firmware;
|
||||
return ret;
|
||||
}
|
||||
|
||||
off = page * size;
|
||||
|
|
@ -968,11 +967,6 @@ static int fsl_xcvr_load_firmware(struct fsl_xcvr *xcvr)
|
|||
}
|
||||
}
|
||||
|
||||
err_firmware:
|
||||
release_firmware(fw);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* configure watermarks */
|
||||
mask = FSL_XCVR_EXT_CTRL_RX_FWM_MASK | FSL_XCVR_EXT_CTRL_TX_FWM_MASK;
|
||||
val = FSL_XCVR_EXT_CTRL_RX_FWM(FSL_XCVR_FIFO_WMK_RX);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user