From: sashiko-bot@kernel.org
To: "David Heidelberg" <david@ixit.cz>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RFC v2 4/6] ASoC: qcom: sdm845: Set codec dai and component sysclk during startup
Date: Thu, 03 Sep 2026 18:40:50 +0000 [thread overview]
Message-ID: <20260903184050.E325B1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260903-pixel3-audio-v2-4-7c22ed915291@ixit.cz>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] Resource leak (clock and refcount) on error path in sdm845_snd_startup.
Pre-existing issues:
- [High] Kernel panic due to NULL pointer dereference in `strcmp()`.
--
commit 620251c05b4c5ac4fb80bf96411a9fcc1f4c402d
Author: David Heidelberg <david@ixit.cz>
ASoC: qcom: sdm845: Set codec dai and component sysclk during startup
The cs35l36 codec needs the codec dai and component sysclk to be set
during TDM startup. Set these for all codec DAIs on the QUATERNARY_TDM
path, gracefully handling codecs that don't support sysclk by ignoring
-ENOTSUPP returns.
> diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
> index 59cfa3b26cd4d..f0fbec9c8df25 100644
> --- a/sound/soc/qcom/sdm845.c
> +++ b/sound/soc/qcom/sdm845.c
> @@ -412,6 +412,28 @@ static int sdm845_snd_startup(struct snd_pcm_substream *substream)
> return ret;
> }
> }
[Severity: High]
This is a pre-existing issue, but can codec_dai->component->name_prefix be
NULL when evaluated in the strcmp() calls just above this block?
If the device tree lacks a sound-name-prefix property for a codec on the
QUATERNARY_TDM link, passing a NULL name_prefix to strcmp() will cause a
kernel panic during startup.
> +
> + /* Set codec sysclk needed by codecs like cs35l36. */
> + ret = snd_soc_dai_set_sysclk(codec_dai, 0,
> + TDM_BCLK_RATE,
> + SND_SOC_CLOCK_IN);
> + if (ret < 0 && ret != -ENOTSUPP) {
> + dev_err(codec_dai->dev,
> + "Failed to set codec dai sysclk: %d\n",
> + ret);
> + return ret;
[Severity: Medium]
Does this early return leak the CPU DAI clock and the clock reference count?
Earlier in sdm845_snd_startup(), the quat_tdm_clk_count is incremented and
the clock is enabled:
if (++(data->quat_tdm_clk_count) == 1) {
snd_soc_dai_set_sysclk(cpu_dai,
Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT,
TDM_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK);
}
If setting the codec DAI sysclk fails and returns here, it bypasses
decrementing this reference count and leaves the CPU DAI sysclk active. The
ALSA/ASoC core does not invoke the machine driver's shutdown callback when
startup fails, meaning this state is permanently leaked.
Is there a need to unwind these resources before returning?
> + }
> +
> + ret = snd_soc_component_set_sysclk(codec_dai->component,
> + 0, 0,
> + TDM_BCLK_RATE,
> + SND_SOC_CLOCK_IN);
> + if (ret < 0 && ret != -ENOTSUPP) {
> + dev_err(codec_dai->dev,
> + "Failed to set codec component sysclk: %d\n",
> + ret);
> + return ret;
[Severity: Medium]
Does this early return also leak the CPU DAI clock and the reference count?
Similar to the previous early return, failing to set the codec component
sysclk will leave the quat_tdm_clk_count incremented and the CPU DAI sysclk
active.
> + }
> }
> break;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-pixel3-audio-v2-0-7c22ed915291@ixit.cz?part=4
next prev parent reply other threads:[~2026-09-03 18:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 18:26 [PATCH RFC v2 0/6] Speakers for Pixel 3 / 3 XL David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg
2026-09-03 18:26 ` [PATCH RFC v2 1/6] ASoC: qcom: sdm845: Demystify TDM masks a bit David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg
2026-09-03 18:40 ` sashiko-bot
2026-09-03 18:26 ` [PATCH RFC v2 2/6] ASoC: qcom: sdm845: use DSP_A format for TDM codec DAIs David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg
2026-09-03 18:26 ` [PATCH RFC v2 3/6] ASoC: qcom: sdm845: Use per-speaker RX masks for TDM slot assignment David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg
2026-09-03 18:41 ` sashiko-bot
2026-09-03 18:26 ` [PATCH RFC v2 4/6] ASoC: qcom: sdm845: Set codec dai and component sysclk during startup David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg
2026-09-03 18:40 ` sashiko-bot [this message]
2026-09-03 18:26 ` [PATCH RFC v2 5/6] ASoC: cs35l36: Implement set_tdm_slot to program RX and TX slots David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg
2026-09-03 18:40 ` sashiko-bot
2026-09-04 8:22 ` Konrad Dybcio
2026-09-04 9:26 ` Charles Keepax
2026-09-04 9:23 ` Charles Keepax
2026-09-03 18:26 ` [PATCH RFC v2 6/6] arm64: dts: qcom: sdm845-google: Add basic audio support David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg
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=20260903184050.E325B1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david@ixit.cz \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.