From: sashiko-bot@kernel.org
To: "David Heidelberg" <david@ixit.cz>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH RFC 4/6] ASoC: qcom: sdm845: Set codec dai and component sysclk during startup
Date: Sun, 05 Jul 2026 20:19:04 +0000 [thread overview]
Message-ID: <20260705201905.6A0031F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260705-pixel3-audio-v1-4-3b66f33859f1@ixit.cz>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Error paths in `sdm845_snd_startup()` fail to decrement clock reference counters, causing permanent resource leaks.
- [High] Un-guarded `strcmp()` on potentially NULL `name_prefix` causes a kernel panic.
--
commit 6324d11aea931e9e3bac52b9aaf6e703b5d354f0
Author: David Heidelberg <david@ixit.cz>
ASoC: qcom: sdm845: Set codec dai and component sysclk during startup
This commit sets the codec dai and component sysclk during TDM startup
for all codec DAIs on the QUATERNARY_TDM path. It gracefully ignores
-ENOTSUPP errors for codecs that do not support sysclk configuration.
> diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
> index 8b65aa3982d47..b2d51e472bc26 100644
> --- a/sound/soc/qcom/sdm845.c
> +++ b/sound/soc/qcom/sdm845.c
> @@ -410,6 +410,28 @@ static int sdm845_snd_startup(struct snd_pcm_substream *substream)
[Severity: High]
This isn't a bug introduced by this patch, but does the pre-existing strcmp()
slightly earlier in this loop safely handle missing device tree properties?
Looking at the code just before this diff in sdm845_snd_startup():
if (!strcmp(codec_dai->component->name_prefix, "Left")) {
If a device tree is missing the sound-name-prefix property, the component's
name_prefix pointer is left as NULL. Since strcmp() doesn't gracefully handle
NULL pointers, does this cause a direct kernel panic during stream startup?
> return ret;
> }
> }
> +
> + /* 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: High]
This is a pre-existing issue, but do these early returns (both the new ones
and the pre-existing format setup checks) leak the clock reference?
At the start of the QUATERNARY_TDM_RX_0 case in sdm845_snd_startup(),
data->quat_tdm_clk_count is incremented and the clock is enabled.
If snd_soc_dai_set_sysclk() fails and returns early here, the ASoC core
handles the .startup failure by calling soc_pcm_clean(), which in turn calls
snd_soc_link_shutdown().
However, snd_soc_link_shutdown() skips the machine driver's .shutdown
callback if the .startup callback itself failed.
Since .shutdown is skipped, the clock reference counts are never decremented,
leaving the CPU DAI clocks permanently enabled. Could we add a cleanup path
to decrement the counters 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;
> + }
> }
> break;
> case SLIMBUS_0_RX...SLIMBUS_6_TX:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260705-pixel3-audio-v1-0-3b66f33859f1@ixit.cz?part=4
next prev parent reply other threads:[~2026-07-05 20:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 20:06 [PATCH RFC 0/6] Speakers for Pixel 3 / 3 XL David Heidelberg via B4 Relay
2026-07-05 20:06 ` [PATCH RFC 1/6] ASoC: qcom: sdm845: Demystify TDM masks a bit David Heidelberg via B4 Relay
2026-07-05 20:19 ` sashiko-bot
2026-07-05 20:06 ` [PATCH RFC 2/6] ASoC: qcom: sdm845: use DSP_A format for TDM codec DAIs David Heidelberg via B4 Relay
2026-07-05 20:18 ` sashiko-bot
2026-07-06 8:33 ` Konrad Dybcio
2026-07-06 9:15 ` David Heidelberg
2026-07-06 9:40 ` Konrad Dybcio
2026-07-05 20:06 ` [PATCH RFC 3/6] ASoC: qcom: sdm845: Use per-speaker RX masks for TDM slot assignment David Heidelberg via B4 Relay
2026-07-05 20:25 ` sashiko-bot
2026-07-05 20:06 ` [PATCH RFC 4/6] ASoC: qcom: sdm845: Set codec dai and component sysclk during startup David Heidelberg via B4 Relay
2026-07-05 20:19 ` sashiko-bot [this message]
2026-07-05 20:06 ` [PATCH RFC 5/6] ASoC: cs35l36: Implement set_tdm_slot to program RX slot register David Heidelberg via B4 Relay
2026-07-05 20:20 ` sashiko-bot
2026-07-06 8:52 ` Charles Keepax
2026-07-06 9:11 ` Konrad Dybcio
2026-07-05 20:06 ` [PATCH RFC 6/6] arm64: dts: qcom: sdm845-google: Add basic audio support David Heidelberg via B4 Relay
2026-07-05 20:18 ` sashiko-bot
2026-07-06 9:14 ` Konrad Dybcio
2026-07-06 9:17 ` David Heidelberg
2026-07-06 11:59 ` Konrad Dybcio
2026-07-06 12:00 ` Konrad Dybcio
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=20260705201905.6A0031F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox