Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hardeep Sharma" <hardeep.sharma@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org,
	linux-clk@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 05/15] clk: qcom: clk-rpmh: Add support for Kuno RPMh clocks
Date: Fri, 21 Aug 2026 16:21:25 +0000	[thread overview]
Message-ID: <20260821162125.D4C6D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260821-kuno-soc-support-v3-5-196e2b306368@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Probe function mutates globally shared static state, causing accumulative corruption on probe retry or unbind/bind.
--

--- Patch [5]: [PATCH v3 05/15] clk: qcom: clk-rpmh: Add support for Kuno RPMh clocks ---
commit 6a55939d348aa54a2946c4b7160f00630d3c9710
Author: Hardeep Sharma <hardeep.sharma@oss.qualcomm.com>

clk: qcom: clk-rpmh: Add support for Kuno RPMh clocks

Add the RPMh clock description for the Qualcomm Kuno SoC so the
qcom,kuno-rpmh-clk compatible can provide the RPMh-managed clocks to
consumers: the CXO div-2 (and always-on variant), RF clock 1 (and
always-on variant), the QPIC BCM clock and the IPA clock.

> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
> index 6367b2a5a4e08..d8c3a6b12d4a4 100644
> --- a/drivers/clk/qcom/clk-rpmh.c
> +++ b/drivers/clk/qcom/clk-rpmh.c

[ ... ]

> @@ -943,6 +943,20 @@ static const struct clk_rpmh_desc clk_rpmh_kaanapali = {
>  	.num_clks = ARRAY_SIZE(kaanapali_rpmh_clocks),
>  };
>  
> +static struct clk_hw *kuno_rpmh_clocks[] = {
> +	[RPMH_CXO_CLK]		= &clk_rpmh_bi_tcxo_div2.hw,
> +	[RPMH_CXO_CLK_A]	= &clk_rpmh_bi_tcxo_div2_ao.hw,
> +	[RPMH_RF_CLK1]		= &clk_rpmh_rf_clk1_a.hw,
> +	[RPMH_RF_CLK1_A]	= &clk_rpmh_rf_clk1_a_ao.hw,
> +	[RPMH_QPIC_CLK]		= &clk_rpmh_qpic_clk.hw,
> +	[RPMH_IPA_CLK]		= &clk_rpmh_ipa.hw,
> +};

[Severity: High]
This is a pre-existing issue, but does adding this new clock array expose it
to state corruption during probe retries or unbind/bind sequences?

Looking at clk_rpmh_probe() in drivers/clk/qcom/clk-rpmh.c, if a clock
resource is missing or if probe fails transitorily and is retried, the
function mutates the statically allocated array:

drivers/clk/qcom/clk-rpmh.c:clk_rpmh_probe() {
    ...
    hw_clks[i] = NULL;
    ...
    rpmh_clk->res_addr += res_addr;
    rpmh_clk->dev = &pdev->dev;
    ...
}

Since kuno_rpmh_clocks is a globally shared static structure, writing NULL here
permanently erases the clock definition for any future bindings.

Additionally, modifying res_addr accumulates the hardware address on subsequent
probe attempts, leading to corrupted register offsets.

Could we avoid mutating these static clock structures by allocating a per-device
copy during probe, or isolating the runtime state from the static clock
descriptions?

> +
> +static const struct clk_rpmh_desc clk_rpmh_kuno = {
> +	.clks = kuno_rpmh_clocks,
> +	.num_clks = ARRAY_SIZE(kuno_rpmh_clocks),
> +};
> +

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260821-kuno-soc-support-v3-0-196e2b306368@oss.qualcomm.com?part=5

  reply	other threads:[~2026-08-21 16:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 16:08 [PATCH v3 00/15] Add initial support for Qualcomm Kuno SoC Hardeep Sharma
2026-08-21 16:08 ` [PATCH v3 01/15] soc: qcom: geni-se: allow selection on 32-bit ARM Qualcomm SoCs Hardeep Sharma
2026-08-24  7:59   ` Abel Vesa
2026-08-21 16:08 ` [PATCH v3 02/15] dt-bindings: power: rpmpd: Document Kuno RPMh power domains Hardeep Sharma
2026-08-21 16:08 ` [PATCH v3 03/15] pmdomain: qcom: rpmhpd: Add power domains for Kuno Hardeep Sharma
2026-08-24  7:58   ` Abel Vesa
2026-08-21 16:08 ` [PATCH v3 04/15] dt-bindings: clock: qcom,rpmhcc: Add Kuno RPMh clock controller Hardeep Sharma
2026-08-21 16:08 ` [PATCH v3 05/15] clk: qcom: clk-rpmh: Add support for Kuno RPMh clocks Hardeep Sharma
2026-08-21 16:21   ` sashiko-bot [this message]
2026-08-24  7:46   ` Abel Vesa
2026-08-21 16:08 ` [PATCH v3 06/15] dt-bindings: interconnect: Add Qualcomm Kuno NoC Hardeep Sharma
2026-08-21 16:09 ` [PATCH v3 07/15] interconnect: qcom: Add Kuno interconnect provider driver Hardeep Sharma
2026-08-24  7:57   ` Abel Vesa
2026-08-21 16:09 ` [PATCH v3 08/15] dt-bindings: pinctrl: qcom: Add Kuno TLMM Hardeep Sharma
2026-08-21 16:09 ` [PATCH v3 09/15] pinctrl: qcom: Add Kuno pinctrl driver Hardeep Sharma
2026-08-24  7:50   ` Abel Vesa
2026-08-21 16:09 ` [PATCH v3 10/15] dt-bindings: clock: qcom: Add Kuno Global Clock Controller Hardeep Sharma
2026-08-21 16:18   ` sashiko-bot
2026-08-21 16:09 ` [PATCH v3 11/15] clk: qcom: Add Global Clock Controller driver for Kuno Hardeep Sharma
2026-08-21 16:25   ` sashiko-bot
2026-08-24  7:40   ` Abel Vesa
2026-08-21 16:09 ` [PATCH v3 12/15] dt-bindings: interrupt-controller: qcom,pdc: Add Kuno compatible string Hardeep Sharma
2026-08-21 16:09 ` [PATCH v3 13/15] dt-bindings: firmware: qcom,scm: Document SCM on Kuno SoC Hardeep Sharma
2026-08-21 16:09 ` [PATCH v3 14/15] dt-bindings: arm: qcom: Document Kuno IDP board Hardeep Sharma
2026-08-21 16:09 ` [PATCH v3 15/15] ARM: dts: qcom: Add initial device tree for Kuno SoC Hardeep Sharma
2026-08-21 16:23   ` sashiko-bot
2026-08-24  7:45   ` Abel Vesa

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=20260821162125.D4C6D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hardeep.sharma@oss.qualcomm.com \
    --cc=linux-clk@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