Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Raghav Sharma" <raghav.s@samsung.com>
Cc: conor+dt@kernel.org, linux-clk@vger.kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 09/14] clk: samsung: exynos8855: add block hsi clock support
Date: Fri, 09 Oct 2026 12:30:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-165541@kernel.org> (raw)
In-Reply-To: <20261009120137.2801911-10-raghav.s@samsung.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] clk: samsung: exynos8855: out-of-bounds write in samsung_clk_add_lookup() due to undersized CLKS_NR_HSI
- [High] clk: samsung: exynos8855: missing CLK_IS_CRITICAL on CLK_GOUT_CMU_HSI leading to system hang
--

commit 24ea6e22468660550351b038f08cf4b975d943f7
Author: Raghav Sharma <raghav.s@samsung.com>

clk: samsung: exynos8855: add block hsi clock support

This commit adds block HSI clock support for the Exynos 8855 SoC. It registers
compatible strings and cmu_info data for CMU_HSI, which provides clocks for
the HSI block.

> diff --git a/drivers/clk/samsung/clk-exynos8855.c b/drivers/clk/samsung/clk-exynos8855.c
> index 2bf889a478bc9..16d71db11ad06 100644
> --- a/drivers/clk/samsung/clk-exynos8855.c
> +++ b/drivers/clk/samsung/clk-exynos8855.c
> @@ -19,7 +19,9 @@
>  #define CLKS_NR_TOP                     (CLKCMU_DOUT_G3D_HTU + 1)
>  #define CLKS_NR_PERIC                   (CLK_GOUT_USI_PERIC + 1)
>  #define CLKS_NR_PERIS                   (CLK_GOUT_WDT1_PERIS + 1)
> +#define CLKS_NR_HSI                     (CLK_GOUT_SYSREG_HSI  + 1)

[Severity: High]
Does this correctly calculate the maximum clock index?

If CLK_GOUT_SYSREG_HSI is 4, this sets CLKS_NR_HSI to 5. This macro
determines the .nr_clk_ids for the HSI block, sizing the
ctx->clk_data.hws array in samsung_clk_init() for 5 elements.

Later in this patch, the hsi_gate_clks array registers clocks with
higher IDs:

    GATE(CLK_GOUT_UFS_EMBD_UNIPRO_HSI, "gout_ufs_embd_unipro_hsi",
         "mout_clkcmu_hsi_ufs_embd_user",
         CMU_HSI_CLK_CON_GAT_BLK_HSI_UID_UFS_EMBD_IPCLKPORT_I_CLK_UNIPRO,
         21, 0, 0),

If CLK_GOUT_UFS_EMBD_UNIPRO_HSI is 6, will registering this clock cause
samsung_clk_add_lookup() to write past the end of the allocated flexible
array?

[ ... ]

> +static const struct samsung_gate_clock hsi_gate_clks[] __initconst = {
> +	/* System will hang if this critical clock is gated */
> +	GATE(CLK_GOUT_CMU_HSI, "gout_cmu_hsi",
> +	     "mout_clkcmu_hsi_noc_user",
> +	     CMU_HSI_CLK_CON_GAT_BLK_HSI_UID_CMU_HSI_IPCLKPORT_PCLK,
> +	     21, 0, 0),

[Severity: High]
Since this clock is critical to prevent a system hang, should the flags
argument be CLK_IS_CRITICAL instead of 0?

Without the critical flag, will the Common Clock Framework dynamically
disable this clock during late init if no active consumer has enabled
it?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009120137.2801911-1-raghav.s@samsung.com?part=9

  reply	other threads:[~2026-10-09 12:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261009114331epcas5p37f60df8cdaf502a0cc492ad5eacf5e05@epcas5p3.samsung.com>
2026-10-09 12:01 ` [PATCH v2 00/14] Add clock support for Exynos8855 SoC Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 01/14] dt-bindings: soc: samsung: Exynos8855 SYSREG compatibles Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 02/14] dt-bindings: clock: exynos8855: add top & peric clock definitions Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 03/14] dt-bindings: clock: exynos8855: add peris " Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 04/14] dt-bindings: clock: exynos8855: add hsi " Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 05/14] dt-bindings: clock: exynos8855: add usb " Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 06/14] clk: samsung: clk-pll: Add support for pll_4313 Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 07/14] clk: samsung: exynos8855: add block top and peric clock support Raghav Sharma
2026-10-09 12:12     ` sashiko-bot
2026-10-09 12:01   ` [PATCH v2 08/14] clk: samsung: exynos8855: add block peris " Raghav Sharma
2026-10-09 12:23     ` sashiko-bot
2026-10-09 12:01   ` [PATCH v2 09/14] clk: samsung: exynos8855: add block hsi " Raghav Sharma
2026-10-09 12:30     ` sashiko-bot [this message]
2026-10-09 12:01   ` [PATCH v2 10/14] clk: samsung: exynos8855: add block usb " Raghav Sharma
2026-10-09 12:48     ` sashiko-bot
2026-10-09 12:01   ` [PATCH v2 11/14] arm64: dts: exynos8855: add cmu_top & cmu_peric clock DT nodes Raghav Sharma
2026-10-09 12:57     ` sashiko-bot
2026-10-09 12:01   ` [PATCH v2 12/14] arm64: dts: exynos8855: add cmu_peris " Raghav Sharma
2026-10-09 12:01   ` [PATCH v2 13/14] arm64: dts: exynos8855: add cmu_hsi " Raghav Sharma
2026-10-09 13:11     ` sashiko-bot
2026-10-09 12:01   ` [PATCH v2 14/14] arm64: dts: exynos8855: add cmu_usb " Raghav Sharma

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-165541@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=raghav.s@samsung.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