From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 3/9] ASoC: qcom: lpass-rx-macro: Add shikra compatible
Date: Wed, 14 Oct 2026 09:28:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-171072@kernel.org> (raw)
In-Reply-To: <20261014-add_shikra_support_v5-v5-3-fb9f0667e613@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] sound/soc: data race on rx_mclk_users leads to premature MCLK disable
--
commit 3e23cc050d00484d829b0a64e250b4871e497cc8
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
ASoC: qcom: lpass-rx-macro: Add shikra compatible
This commit adds the shikra RX macro compatible data and hooks it into the
LPASS codec v4.1 flow. It reuses existing v2.5 register access helpers and
configures the FS counter to be bypassed before MCLK is enabled.
> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
> index c41eb8de61609..93ceee878b78a 100644
> --- a/sound/soc/codecs/lpass-rx-macro.c
> +++ b/sound/soc/codecs/lpass-rx-macro.c
[ ... ]
> @@ -2041,20 +2044,25 @@ static int rx_macro_mclk_enable(struct rx_macro *rx, bool mclk_enable)
>
> if (mclk_enable) {
> if (rx->rx_mclk_users == 0) {
> regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL,
> CDC_RX_CLK_MCLK_EN_MASK |
> CDC_RX_CLK_MCLK2_EN_MASK,
> CDC_RX_CLK_MCLK_ENABLE |
> CDC_RX_CLK_MCLK2_ENABLE);
> regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
> CDC_RX_FS_MCLK_CNT_CLR_MASK, 0x00);
> +
> + if (rx->fs_cnt_bypass)
> + regmap_set_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
> + CDC_RX_FS_CNT_BYPASS);
> +
> regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
> CDC_RX_FS_MCLK_CNT_EN_MASK,
> CDC_RX_FS_MCLK_CNT_ENABLE);
> regcache_mark_dirty(regmap);
> ret = regcache_sync(regmap);
> if (ret)
> return ret;
> }
> rx->rx_mclk_users++;
[Severity: Medium]
Could this function be susceptible to a data race on rx->rx_mclk_users?
It appears that rx_macro_mclk_enable() can be called from two different
concurrency domains without internal locking: swclk_gate_enable() and
swclk_gate_disable() (which execute under the clock framework's prepare_lock
mutex) and rx_macro_mclk_event() (which executes under ALSA DAPM's
dapm_mutex).
If the rx->rx_mclk_users counter is checked and modified non-atomically,
could concurrent stream start and clock enable events cause a lost increment?
If an increment is lost, when one stream later stops, rx_mclk_users could
drop to 0 prematurely, disabling the MCLK hardware while the other stream
is still actively relying on it.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-add_shikra_support_v5-v5-0-fb9f0667e613@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-10-14 9:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 9:12 [PATCH v5 0/9] ASoC: qcom: Add shikra and Hawi LPASS macro support Mohammad Rafi Shaik
2026-10-14 9:12 ` [PATCH v5 1/9] ASoC: dt-bindings: qcom: Add Shikra RX and VA macro codecs Mohammad Rafi Shaik
2026-10-14 9:12 ` [PATCH v5 2/9] ASoC: qcom: lpass-macro-common: Add missing v2.9 version string Mohammad Rafi Shaik
2026-10-14 9:12 ` [PATCH v5 3/9] ASoC: qcom: lpass-rx-macro: Add shikra compatible Mohammad Rafi Shaik
2026-10-14 9:28 ` sashiko-bot [this message]
2026-10-14 9:12 ` [PATCH v5 4/9] ASoC: qcom: lpass-va-macro: " Mohammad Rafi Shaik
2026-10-14 9:12 ` [PATCH v5 5/9] ASoC: qcom: lpass-va-macro: Add SoundWire microphone support Mohammad Rafi Shaik
2026-10-14 9:30 ` sashiko-bot
2026-10-14 9:12 ` [PATCH v5 6/9] ASoC: dt-bindings: qcom: Add Hawi LPASS macro codecs Mohammad Rafi Shaik
2026-10-14 9:35 ` sashiko-bot
2026-10-14 9:12 ` [PATCH v5 7/9] ASoC: dt-bindings: qcom: Add Maili " Mohammad Rafi Shaik
2026-10-14 9:12 ` [PATCH v5 8/9] ASoC: qcom: lpass-tx-macro: Add support for Bolero v4.0 Mohammad Rafi Shaik
2026-10-14 9:35 ` sashiko-bot
2026-10-14 9:12 ` [PATCH v5 9/9] ASoC: qcom: lpass: Add support for LPASS codec v4.0 Mohammad Rafi Shaik
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-171072@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mohammad.rafi.shaik@oss.qualcomm.com \
--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