Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hardeep Sharma" <hardeep.sharma@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 05/15] clk: qcom: clk-rpmh: Add support for Kuno RPMh clocks
Date: Thu, 27 Aug 2026 16:49:03 +0000	[thread overview]
Message-ID: <20260827164903.A73D21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827-kuno-soc-support-v4-5-dd34f235fc1a@oss.qualcomm.com>

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

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but this patch adds new instances of static arrays (like `kuno_rpmh_clocks`) that are subjected to the same corruption. Global static structures and arrays in clk-rpmh are permanently mutated during probe, leading to resource address corruption and dropped clocks across unbind/rebind or probe deferrals.
--

commit 05d4af4c482cb487c2654eee526d1d872c910869
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.

> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
> index a224a94ae2733..ec8700b6186d8 100644
> --- a/drivers/clk/qcom/clk-rpmh.c
> +++ b/drivers/clk/qcom/clk-rpmh.c
> @@ -937,6 +937,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,
> +};
> +
> +static const struct clk_rpmh_desc clk_rpmh_kuno = {
> +	.clks = kuno_rpmh_clocks,

[Severity: High]
This is a pre-existing issue, but adding this new array subjects it to a bug
in the clk-rpmh driver's probe path.

Will this statically allocated array and the clocks it points to be corrupted
during probe deferrals or driver unbind/rebind cycles?

In clk_rpmh_probe(), the globally shared static array and the structures it
references are permanently mutated:

drivers/clk/qcom/clk-rpmh.c:clk_rpmh_probe() {
    ...
		if (!has_state_changed && rpmh_clk->state) {
			hw_clks[i] = NULL;
			continue;
		}

		rpmh_clk->res_addr += res_addr;
    ...
}

Because kuno_rpmh_clocks is a static array, hw_clks[i] = NULL permanently
drops the clock for all subsequent probe attempts.

Additionally, rpmh_clk->res_addr += res_addr incorrectly accumulates the
hardware resource address multiple times across probes, which can cause the
driver to write to out-of-bounds addresses when sending RPMh commands.

> +	.num_clks = ARRAY_SIZE(kuno_rpmh_clocks),
> +};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827-kuno-soc-support-v4-0-dd34f235fc1a@oss.qualcomm.com?part=5

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

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

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=20260827164903.A73D21F000E9@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