From: sashiko-bot@kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v10 2/6] clk: Introduce clk_hw_set_spread_spectrum
Date: Fri, 12 Jun 2026 08:54:12 +0000 [thread overview]
Message-ID: <20260612085413.3AE211F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612-clk-v10-v10-2-eb92484eda38@nxp.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] clk_hw_set_spread_spectrum() modifies clock hardware state without checking if the clock rate is exclusively protected.
- [Medium] clk_hw_set_spread_spectrum() silently returns success (0) when the clock provider does not implement the set_spread_spectrum callback.
--
commit fbe42efd1852814fc95559f8dd8be280e7cdb66e
Author: Peng Fan <peng.fan@nxp.com>
clk: Introduce clk_hw_set_spread_spectrum
This commit adds clk_hw_set_spread_spectrum() to configure the spread spectrum
feature of a clock. It also introduces the set_spread_spectrum callback for
clock drivers to provide hardware-specific implementations.
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 048adfa86a5d0..8c78621cde253 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
[ ... ]
> @@ -2774,6 +2774,33 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate)
> }
> EXPORT_SYMBOL_GPL(clk_set_max_rate);
>
> +int clk_hw_set_spread_spectrum(struct clk_hw *hw, const struct clk_spread_spectrum *ss_conf)
> +{
> + struct clk_core *core;
> + int ret;
> +
> + if (!hw)
> + return 0;
> +
> + core = hw->core;
> +
> + clk_prepare_lock();
> +
> + ret = clk_pm_runtime_get(core);
> + if (ret)
> + goto fail;
> +
[Severity: High]
Should this check if the clock rate is exclusively protected before modifying
the hardware state?
Other clock adjustment functions like clk_set_phase() or clk_set_rate() check
clk_core_rate_is_protected(core) and return -EBUSY to prevent interference
with consumers that require a strict, stable clock. Since enabling spread
spectrum dynamically modulates the frequency, it seems like it could disrupt
consumers relying on that protection.
> + if (core->ops->set_spread_spectrum)
> + ret = core->ops->set_spread_spectrum(hw, ss_conf);
> +
[Severity: Medium]
If the clock provider does not implement the set_spread_spectrum callback,
will this silently return 0 (success) because ret was set to 0 by a
successful clk_pm_runtime_get(core)?
Returning success when the operation is unsupported might mislead callers into
believing the spread spectrum modulation is active. Does it make sense to
return an error code like -EOPNOTSUPP instead?
> + clk_pm_runtime_put(core);
> +
> +fail:
> + clk_prepare_unlock();
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_set_spread_spectrum);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260612-clk-v10-v10-0-eb92484eda38@nxp.com?part=2
next prev parent reply other threads:[~2026-06-12 8:54 UTC|newest]
Thread overview: 12+ 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 [this message]
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
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-15 16:40 ` Brian Masney
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=20260612085413.3AE211F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.