Linux Sound subsystem development
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: "Mark Brown" <broonie@kernel.org>,
	linux-sound@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Nuno Sá" <nuno.sa@analog.com>
Subject: Re: [PATCH 17/31] ASoC: sigmadsp: se auto-cleanup for firmware loading
Date: Wed, 5 Aug 2026 17:08:59 +0100	[thread overview]
Message-ID: <anNgBxpLVkydoqII@nsa> (raw)
In-Reply-To: <20260805135247.670693-18-tiwai@suse.de>

On Wed, Aug 05, 2026 at 03:52:18PM +0200, Takashi Iwai wrote:
> Simplify the code to manage the firmware loading with __free(firmware)
> auto-cleanup.
> 
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Nuno Sá <nuno.sa@analog.com>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---

Acked-by: Nuno Sá <nuno.sa@analog.com>

>  sound/soc/codecs/sigmadsp.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
> index b7dbeb237447..4ecbbac93258 100644
> --- a/sound/soc/codecs/sigmadsp.c
> +++ b/sound/soc/codecs/sigmadsp.c
> @@ -484,7 +484,7 @@ static void devm_sigmadsp_release(struct device *dev, void *res)
>  static int sigmadsp_firmware_load(struct sigmadsp *sigmadsp, const char *name)
>  {
>  	const struct sigma_firmware_header *ssfw_head;
> -	const struct firmware *fw;
> +	const struct firmware *fw __free(firmware) = NULL;
>  	int ret;
>  	u32 crc;
>  
> @@ -492,7 +492,7 @@ static int sigmadsp_firmware_load(struct sigmadsp *sigmadsp, const char *name)
>  	ret = request_firmware(&fw, name, sigmadsp->dev);
>  	if (ret) {
>  		pr_debug("%s: request_firmware() failed with %i\n", __func__, ret);
> -		goto done;
> +		return ret;
>  	}
>  
>  	/* then verify the header */
> @@ -506,13 +506,13 @@ static int sigmadsp_firmware_load(struct sigmadsp *sigmadsp, const char *name)
>  	 */
>  	if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) {
>  		dev_err(sigmadsp->dev, "Failed to load firmware: Invalid size\n");
> -		goto done;
> +		return -EINVAL;
>  	}
>  
>  	ssfw_head = (void *)fw->data;
>  	if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) {
>  		dev_err(sigmadsp->dev, "Failed to load firmware: Invalid magic\n");
> -		goto done;
> +		return -EINVAL;
>  	}
>  
>  	crc = crc32(0, fw->data + sizeof(*ssfw_head),
> @@ -521,7 +521,7 @@ static int sigmadsp_firmware_load(struct sigmadsp *sigmadsp, const char *name)
>  	if (crc != le32_to_cpu(ssfw_head->crc)) {
>  		dev_err(sigmadsp->dev, "Failed to load firmware: Wrong crc checksum: expected %x got %x\n",
>  			le32_to_cpu(ssfw_head->crc), crc);
> -		goto done;
> +		return -EINVAL;
>  	}
>  
>  	switch (ssfw_head->version) {
> @@ -542,9 +542,6 @@ static int sigmadsp_firmware_load(struct sigmadsp *sigmadsp, const char *name)
>  	if (ret)
>  		sigmadsp_firmware_release(sigmadsp);
>  
> -done:
> -	release_firmware(fw);
> -
>  	return ret;
>  }
>  
> -- 
> 2.55.0
> 

  reply	other threads:[~2026-08-05 16:07 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 13:52 [PATCH 00/31] ASoC: Use auto-cleanup for firmware loading Takashi Iwai
2026-08-05 13:52 ` [PATCH 01/31] ASoC: aw87390: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 02/31] ASoC: aw88081: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 03/31] ASoC: aw88166: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 04/31] ASoC: aw88261: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 05/31] ASoC: aw88395: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 06/31] ASoC: aw88399: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 07/31] ASoC: fs-amp-lib: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 08/31] ASoC: hdac_hda: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 09/31] ASoC: max98390: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 10/31] ASoC: ntpfw: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 11/31] ASoC: pcm6240: " Takashi Iwai
2026-08-05 16:47   ` Herve Codina
2026-08-06  6:16     ` Takashi Iwai
2026-08-05 13:52 ` [PATCH 12/31] ASoC: peb2466: " Takashi Iwai
2026-08-05 16:50   ` Herve Codina
2026-08-05 13:52 ` [PATCH 13/31] ASoC: rt1320-sdw: " Takashi Iwai
2026-08-05 22:56   ` Mark Brown
2026-08-06  7:37     ` Takashi Iwai
2026-08-06 11:52       ` Mark Brown
2026-08-06 13:48         ` Takashi Iwai
2026-08-05 13:52 ` [PATCH 14/31] ASoC: rt5575: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 15/31] ASoC: rt5677: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 16/31] ASoC: rt722-sdca: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 17/31] ASoC: sigmadsp: se " Takashi Iwai
2026-08-05 16:08   ` Nuno Sá [this message]
2026-08-05 13:52 ` [PATCH 18/31] ASoC: sma1307: Use " Takashi Iwai
2026-08-05 13:52 ` [PATCH 19/31] ASoC: tas2781: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 20/31] ASoC: tas5805m: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 21/31] ASoC: tlv320aic31xx: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 22/31] ASoC: wm0010: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 23/31] ASoC: wm2000: " Takashi Iwai
2026-08-05 23:16   ` Mark Brown
2026-08-06  7:38     ` Takashi Iwai
2026-08-05 13:52 ` [PATCH 24/31] ASoC: zl38060: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 25/31] ASoC: fsl: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 26/31] ASoC: Intel: avs: " Takashi Iwai
2026-08-05 14:48   ` Cezary Rojewski
2026-08-05 13:52 ` [PATCH 27/31] ASoC: Intel: catpt: " Takashi Iwai
2026-08-05 14:48   ` Cezary Rojewski
2026-08-05 13:52 ` [PATCH 28/31] ASoC: qcom: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 29/31] ASoC: renesas: " Takashi Iwai
2026-08-05 13:52 ` [PATCH 30/31] ASoC: SDCA: " Takashi Iwai
2026-08-05 14:34   ` Charles Keepax
2026-08-05 13:52 ` [PATCH 31/31] ASoC: SOF: " Takashi Iwai
2026-08-06 11:56   ` Péter Ujfalusi
2026-08-06 12:06     ` Takashi Iwai
2026-08-06 13:04       ` Péter Ujfalusi
2026-08-06 13:18         ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anNgBxpLVkydoqII@nsa \
    --to=noname.nuno@gmail.com \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-sound@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox