From: sashiko-bot@kernel.org
To: "Dario Binacchi" <dario.binacchi@amarulasolutions.com>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH v13 2/4] clk: scmi: reject SSC configuration out of the OEM field range
Date: Thu, 03 Sep 2026 15:51:56 +0000 [thread overview]
Message-ID: <20260903155156.92AD21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903153836.373267-3-dario.binacchi@amarulasolutions.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional rejection of `spread_pm == 0` breaks the ability to disable Spread Spectrum Clocking (SSC).
--
commit bf8cfe80822f02414072ae479a6270e985c74e54
Author: Dario Binacchi <dario.binacchi@amarulasolutions.com>
clk: scmi: reject SSC configuration out of the OEM field range
This commit adds validation to reject spread spectrum configurations that
exceed the 8-bit OEM field range or the 16-bit modulation frequency field.
It aims to prevent silent truncation and incorrect programming of the
firmware.
> diff --git a/drivers/clk/clk-scmi-oem.c b/drivers/clk/clk-scmi-oem.c
> index c1ebbdc6bbc5f..4dac608edd4ce 100644
> --- a/drivers/clk/clk-scmi-oem.c
> +++ b/drivers/clk/clk-scmi-oem.c
> @@ -35,6 +35,7 @@ scmi_clk_imx_set_spread_spectrum(struct clk_hw *hw,
> const struct clk_spread_spectrum *ss_conf)
> {
> struct scmi_clk *clk = to_scmi_clk(hw);
> + u32 spread_pm = ss_conf->spread_bp / 10;
> int ret;
> u32 val;
>
> @@ -44,7 +45,19 @@ scmi_clk_imx_set_spread_spectrum(struct clk_hw *hw,
> * extConfigValue[24] - Enable/Disable
> * extConfigValue[31:25] - Reserved
> */
> - val = FIELD_PREP(SCMI_CLOCK_IMX_SS_PERCENTAGE_MASK, ss_conf->spread_bp / 10);
> + if (!spread_pm || spread_pm > FIELD_MAX(SCMI_CLOCK_IMX_SS_PERCENTAGE_MASK)) {
> + dev_warn(clk->dev, "%s: spread (%u permyriad) out of range\n",
> + clk_hw_get_name(hw), ss_conf->spread_bp);
> + return -EINVAL;
> + }
[Severity: High]
Does this unconditional rejection of spread_pm == 0 break the ability to
disable Spread Spectrum Clocking (SSC)?
When a caller (or device tree via assigned-clock-sscs) requests to disable
SSC, it generally sets method = CLK_SPREAD_NO and spread_bp = 0. Because
spread_pm is calculated as ss_conf->spread_bp / 10, a 0 spread results in
spread_pm == 0, triggering this -EINVAL return.
Since the driver contains logic to handle method == CLK_SPREAD_NO by omitting
the SCMI_CLOCK_IMX_SS_ENABLE_MASK bit, it appears designed to support disabling
SSC. This new check prevents that valid path from executing and could abort
device probing if triggered during initialization.
Should the !spread_pm check be restricted to cases where
ss_conf->method != CLK_SPREAD_NO?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903153836.373267-1-dario.binacchi@amarulasolutions.com?part=2
next prev parent reply other threads:[~2026-09-03 15:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 15:32 [PATCH v13 0/4] Support spread spectrum clocking for i.MX8M PLLs Dario Binacchi
2026-09-03 15:32 ` [PATCH v13 1/4] clk: scmi: fix SSC spread conversion Dario Binacchi
2026-09-04 4:33 ` Peng Fan
2026-09-03 15:32 ` [PATCH v13 2/4] clk: scmi: reject SSC configuration out of the OEM field range Dario Binacchi
2026-09-03 15:51 ` sashiko-bot [this message]
2026-09-04 4:38 ` Peng Fan
2026-09-04 10:03 ` Dario Binacchi
2026-09-03 15:32 ` [PATCH v13 3/4] clk: validate spread spectrum configuration Dario Binacchi
2026-09-04 4:39 ` Peng Fan
2026-09-03 15:32 ` [PATCH v13 4/4] clk: imx: pll14xx: support spread spectrum clock generation Dario Binacchi
2026-09-03 15:51 ` sashiko-bot
2026-09-04 4:45 ` Peng Fan
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=20260903155156.92AD21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dario.binacchi@amarulasolutions.com \
--cc=linux-clk@vger.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