From: sashiko-bot@kernel.org
To: "Stefan Binding" <sbinding@opensource.cirrus.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v3 6/8] ALSA: hda/cs35l41: Store filenames of successfully loaded firmware and tunings
Date: Thu, 03 Dec 2026 16:24:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-248195@kernel.org> (raw)
In-Reply-To: <20261203141359.150688-7-sbinding@opensource.cirrus.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ALSA: hda/cs35l41: leak of cached filenames on
component_add() failure
- [Low] ALSA: hda/cs35l41: skip_tuning_params latched on transient
firmware errors
--
commit 513d2c01c40a2002d0419b32112d33551ebde10f
Author: Stefan Binding <sbinding@opensource.cirrus.com>
ALSA: hda/cs35l41: Store filenames of successfully loaded firmware and tunings
This commit caches the successfully loaded firmware and coefficient
filenames in struct cs35l41_hda so subsequent reloads reuse them directly
instead of searching candidate filenames again. It also records when
tuning parameter files fail to load to skip requesting them later.
> diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda.c b/sound/hda/codecs/side-codecs/cs35l41_hda.c
> index 2c6efd07df801..51ac11270c88f 100644
> --- a/sound/hda/codecs/side-codecs/cs35l41_hda.c
> +++ b/sound/hda/codecs/side-codecs/cs35l41_hda.c
> @@ -142,6 +142,7 @@ static int cs35l41_request_tuning_param_file(struct cs35l41_hda *cs35l41, char *
> dev_dbg(cs35l41->dev, "Failed to request '%s'\n", *filename);
> kfree(*filename);
> *filename = NULL;
> + cs35l41->skip_tuning_params = true;
> }
>
> return ret;
[Severity: Low]
Can a transient firmware_request_nowarn() error (such as -ENOMEM or -EIO)
permanently latch cs35l41->skip_tuning_params?
Any non-zero return sets skip_tuning_params and nothing clears it, even if
the file already loaded on boot and failed temporarily on resume. Since
cs35l41_init_dsp() resets tuning_gain to DEFAULT_AMP_GAIN_PCM on each
reload, the tuned gain stays lost until driver removal.
Only latching skip_tuning_params on initial load when the file is missing
would avoid this.
[ ... ]
> @@ -600,6 +623,10 @@ static void cs35l41_remove_dsp(struct cs35l41_hda *cs35l41)
> cs35l41_shutdown_dsp(cs35l41);
> cs_dsp_remove(dsp);
> cs35l41->halo_initialized = false;
> + kfree(cs35l41->wmfw_filename);
> + kfree(cs35l41->coeff_filename);
> + cs35l41->wmfw_filename = NULL;
> + cs35l41->coeff_filename = NULL;
> }
[Severity: Medium]
Can cs35l41->wmfw_filename and cs35l41->coeff_filename leak if
component_add() fails in cs35l41_hda_probe()?
component_add() can synchronously invoke cs35l41_hda_bind() ->
cs35l41_smart_amp() -> cs35l41_init_dsp() to allocate both strings. If
cs35l41_create_controls() then fails, cs35l41_hda_probe() unwinds without
calling cs35l41_remove_dsp(), and cs35l41_hda_remove() never runs.
Freeing both strings in the probe error path would avoid the leak.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203141359.150688-1-sbinding@opensource.cirrus.com?part=6
next prev parent reply other threads:[~2026-12-03 16:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 14:13 [PATCH v3 0/8] Fixes and improvements in CS35L41 HDA driver for System Suspend/Resume Stefan Binding
2026-12-03 14:13 ` [PATCH v3 1/8] ALSA: hda: cs35l41: Remove redundant lock_system_sleep() calls Stefan Binding
2026-12-03 14:13 ` [PATCH v3 2/8] ASoC: cs35l41: Prevent software reset when using SPI Stefan Binding
2026-12-03 14:55 ` sashiko-bot
2026-12-03 15:25 ` Mark Brown
2026-12-03 14:13 ` [PATCH v3 3/8] ALSA: hda: cs35l41: Unset irq if not used or configured Stefan Binding
2026-12-03 14:13 ` [PATCH v3 4/8] ALSA: hda/cs35l41: Split System Suspend/Resume callbacks Stefan Binding
2026-12-03 15:41 ` sashiko-bot
2026-12-03 14:13 ` [PATCH v3 5/8] ALSA: hda/cs35l41: Remove support for alternative firmware types Stefan Binding
2026-12-03 14:13 ` [PATCH v3 6/8] ALSA: hda/cs35l41: Store filenames of successfully loaded firmware and tunings Stefan Binding
2026-12-03 16:24 ` sashiko-bot [this message]
2026-12-03 14:13 ` [PATCH v3 7/8] ALSA: hda/cs35l41: rework how firmware requests are queued and flushed to prevent races Stefan Binding
2026-12-03 14:13 ` [PATCH v3 8/8] ALSA: hda/cs35l41: Ensure SPI devices are always reset during system suspend Stefan Binding
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=sashiko-outbox-248195@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sbinding@opensource.cirrus.com \
/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