From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: linux-sound@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH 06/14] ALSA: hda: cs35l56: Use auto-cleanup for firmware loading
Date: Thu, 30 Jul 2026 10:35:56 +0100 [thread overview]
Message-ID: <amsa/K5eyyCBwNLa@opensource.cirrus.com> (raw)
In-Reply-To: <20260729083735.120219-7-tiwai@suse.de>
On Wed, Jul 29, 2026 at 10:37:24AM +0200, Takashi Iwai wrote:
> Simplify the code to manage the firmware loading with auto-cleanup.
> By the use of __free(firmware), we can replace the manual mutex locks
> with guard() gracefully, too.
>
> Only the code refactoring, no functional changes.
>
> Cc: patches@opensource.cirrus.com
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> sound/hda/codecs/side-codecs/cs35l56_hda.c | 35 ++++++----------------
> 1 file changed, 9 insertions(+), 26 deletions(-)
>
> diff --git a/sound/hda/codecs/side-codecs/cs35l56_hda.c b/sound/hda/codecs/side-codecs/cs35l56_hda.c
> index 78c2cf387a00..bc207ab5b020 100644
> --- a/sound/hda/codecs/side-codecs/cs35l56_hda.c
> +++ b/sound/hda/codecs/side-codecs/cs35l56_hda.c
> @@ -527,18 +527,6 @@ static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56,
> base_name, NULL, NULL, "bin");
> }
>
> -static void cs35l56_hda_release_firmware_files(const struct firmware *wmfw_firmware,
> - char *wmfw_filename,
> - const struct firmware *coeff_firmware,
> - char *coeff_filename)
> -{
> - release_firmware(wmfw_firmware);
> - kfree(wmfw_filename);
> -
> - release_firmware(coeff_firmware);
> - kfree(coeff_filename);
> -}
> -
> static int cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56)
> {
> int ret;
> @@ -561,10 +549,10 @@ static int cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56)
>
> static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
> {
> - const struct firmware *coeff_firmware = NULL;
> - const struct firmware *wmfw_firmware = NULL;
> - char *coeff_filename = NULL;
> - char *wmfw_filename = NULL;
> + const struct firmware *coeff_firmware __free(firmware) = NULL;
> + const struct firmware *wmfw_firmware __free(firmware) = NULL;
Is it definitely safe to replace release_firmware with kfree? In
most cases that is all release_firmware does, but it looks like
it does different stuff if someone built the firmware into the
kernel?
Thanks,
Charles
next prev parent reply other threads:[~2026-07-30 9:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 8:37 [PATCH 00/14] ALSA: Use auto-cleanup for firmware loading Takashi Iwai
2026-07-29 8:37 ` [PATCH 01/14] ALSA: 6fire: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 02/14] ALSA: hda: ca0132: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 03/14] ALSA: hda: intel: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 04/14] ALSA: msnd: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 05/14] ALSA: hda: cs35l41: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 06/14] ALSA: hda: cs35l56: " Takashi Iwai
2026-07-30 9:35 ` Charles Keepax [this message]
2026-07-30 9:45 ` Takashi Iwai
2026-07-30 10:21 ` Charles Keepax
2026-07-30 14:51 ` Richard Fitzgerald
2026-07-29 8:37 ` [PATCH 07/14] ALSA: sscape: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 08/14] ALSA: wavefront: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 09/14] ALSA: asihpi: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 10/14] ALSA: cs46xx: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 11/14] ALSA: korg1212: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 12/14] ALSA: mixart: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 13/14] ALSA: pcxhr: " Takashi Iwai
2026-07-29 8:37 ` [PATCH 14/14] ALSA: sh: " 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=amsa/K5eyyCBwNLa@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.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