From: sashiko-bot@kernel.org
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v10 3/6] clk: conf: Support assigned-clock-sscs
Date: Fri, 12 Jun 2026 08:54:55 +0000 [thread overview]
Message-ID: <20260612085455.9216C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612-clk-v10-v10-3-eb92484eda38@nxp.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Spread Spectrum Configuration (SSC) is applied before clock parents and rates are set, which can result in the SSC configuration being overwritten or becoming mathematically invalid.
- [Medium] Parsing `assigned-clock-sscs` by casting an array of `struct clk_spread_spectrum` to a `u32 *` violates strict typing and is highly brittle.
--
commit dcd88e4f08b6ae89c38dd70d8a94011d30708d37
Author: Peng Fan <peng.fan@nxp.com>
clk: conf: Support assigned-clock-sscs
This commit adds support for parsing Spread Spectrum Configuration (SSC) from
the device tree and configuring clocks accordingly. It introduces a new
function to read the assigned-clock-sscs property and apply the settings.
> diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c
> index 303a0bb26e54a..550b8ae375a2c 100644
> --- a/drivers/clk/clk-conf.c
> +++ b/drivers/clk/clk-conf.c
> @@ -155,6 +155,78 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier)
[ ... ]
> +static int __set_clk_spread_spectrum(struct device_node *node, bool clk_supplier)
> +{
[ ... ]
> + sscs = kcalloc(count, elem_size, GFP_KERNEL);
> + if (!sscs)
> + return -ENOMEM;
> +
> + rc = of_property_read_u32_array(node, "assigned-clock-sscs", (u32 *)sscs,
> + count * 3);
[Severity: Medium]
Is it safe to cast an array of struct clk_spread_spectrum to u32 * here?
If any fields are added to the struct or the compiler adds padding, the OF
helper will read data in 12-byte chunks, which will silently misalign with the
struct array boundaries for all elements after the first.
Would it be better to read into a dynamically allocated temporary u32 array
and explicitly populate each struct field?
> + if (rc)
> + goto free_sscs;
> +
[ ... ]
> @@ -174,6 +246,10 @@ int of_clk_set_defaults(struct device_node *node, bool clk_supplier)
> if (!node)
> return 0;
>
> + rc = __set_clk_spread_spectrum(node, clk_supplier);
> + if (rc < 0)
> + return rc;
> +
> rc = __set_clk_parents(node, clk_supplier);
[Severity: High]
Does configuring spread spectrum before setting clock parents and rates cause
issues?
Spread spectrum modulates the base frequency, so its hardware parameters
usually depend on the final base rate and parent clock. By configuring SSC
first, the settings might be computed based on the old hardware state, or
subsequent rate and parent changes might wipe out the SSC settings.
Should SSC be configured after parents and rates are set?
> if (rc < 0)
> return rc;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260612-clk-v10-v10-0-eb92484eda38@nxp.com?part=3
next prev parent reply other threads:[~2026-06-12 8:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 8:46 [PATCH v10 0/6] clk: Support spread spectrum and use it in clk-scmi Peng Fan (OSS)
2026-06-12 8:46 ` [PATCH v10 1/6] dt-bindings: clock: Add spread spectrum definition Peng Fan (OSS)
2026-06-12 8:46 ` [PATCH v10 2/6] clk: Introduce clk_hw_set_spread_spectrum Peng Fan (OSS)
2026-06-12 8:54 ` sashiko-bot
2026-06-12 8:46 ` [PATCH v10 3/6] clk: conf: Support assigned-clock-sscs Peng Fan (OSS)
2026-06-12 8:54 ` sashiko-bot [this message]
2026-06-12 8:46 ` [PATCH v10 4/6] clk: Add KUnit tests for assigned-clock-sscs Peng Fan (OSS)
2026-06-12 8:55 ` sashiko-bot
2026-06-12 8:46 ` [PATCH v10 5/6] clk: scmi: Introduce common header for SCMI clock interface Peng Fan (OSS)
2026-06-12 8:46 ` [PATCH v10 6/6] clk: scmi: Add i.MX95 OEM extension support for SCMI clock driver Peng Fan (OSS)
2026-06-12 8: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=20260612085455.9216C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--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