From: sashiko-bot@kernel.org
To: "Shubhrajyoti Datta" <shubhrajyoti.datta@amd.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 2/8] clk: clocking-wizard: Do not map the memory for static-config
Date: Fri, 31 Jul 2026 07:33:32 +0000 [thread overview]
Message-ID: <20260731073332.92D041F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260731072049.957624-3-shubhrajyoti.datta@amd.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [High] Unconditional AXI clock fetch breaks probe in static-config mode.
Pre-existing issues:
- [High] Driver completely skips parsing and registering output clocks when static-config is enabled, acting as a silent stub.
- [High] The driver shares a single `struct notifier_block` instance to register rate-change notifiers for two different clocks, corrupting the kernel's SRCU notifier chains.
- [High] Ineffective value cap allows writing out-of-range values to hardware registers.
--
--- Patch [2]: [PATCH v3 2/8] clk: clocking-wizard: Do not map the memory for static-config ---
commit 5be3eccdee47c9c51ffe9fd16deab92141ef8346
Author: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Subject: clk: clocking-wizard: Do not map the memory for static-config
With xlnx,static-config the MMCM/PLL topology is fixed at synthesis time
and no register programming is performed; only the dynamic path needs
the AXI register block. Move devm_platform_ioremap_resource() under the
non-static-config branch.
> diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> index 4a0136349f71a..e082051221bef 100644
> --- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> +++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
[ ... ]
> static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate,
> unsigned long parent_rate)
> {
[ ... ]
> value = DIV_ROUND_CLOSEST(parent_rate, rate);
>
> /* Cap the value to max */
> min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE);
>
> /* Set divisor and clear phase offset */
> writel(value, div_addr);
[Severity: High]
This is a pre-existing issue, but is the value cap effective here?
The min_t() macro evaluates as a standalone statement and doesn't modify its
arguments in place. Because the returned minimum value is discarded, the
'value' variable remains entirely uncapped when passed to writel(). If the
calculated divisor exceeds the expected width, it could corrupt adjacent bit
fields within the hardware register.
[ ... ]
> @@ -1168,10 +1168,6 @@ static int clk_wzrd_probe(struct platform_device *pdev)
> return -ENOMEM;
> platform_set_drvdata(pdev, clk_wzrd);
>
> - clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0);
> - if (IS_ERR(clk_wzrd->base))
> - return PTR_ERR(clk_wzrd->base);
> -
> clk_wzrd->axi_clk = devm_clk_get_enabled(&pdev->dev, "s_axi_aclk");
> if (IS_ERR(clk_wzrd->axi_clk))
> return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->axi_clk),
[Severity: High]
Does this unconditionally fail the probe when static-config is enabled?
The commit message notes that only the dynamic path needs the AXI block, which
implies "s_axi_aclk" might be omitted from the device tree for static
configurations. If the clock is missing, devm_clk_get_enabled() will return
-ENOENT and immediately abort the probe before reaching the static-config
check.
> @@ -1183,6 +1179,10 @@ static int clk_wzrd_probe(struct platform_device *pdev)
> }
>
> if (!of_property_present(np, "xlnx,static-config")) {
> + clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(clk_wzrd->base))
> + return PTR_ERR(clk_wzrd->base);
> +
[Severity: High]
This is a pre-existing issue, but does this branch entirely skip clock
registration for static configurations?
When "xlnx,static-config" is present, the driver skips this block and simply
returns 0 at the end of the probe function. No fixed-factor clocks are
registered, meaning any downstream consumers requesting a clock from this
provider will indefinitely defer their probe (-EPROBE_DEFER).
[ ... ]
> ret = devm_clk_notifier_register(&pdev->dev, clk_wzrd->clk_in1,
> &clk_wzrd->nb);
> if (ret)
> dev_warn(&pdev->dev,
> "unable to register clock notifier\n");
>
> ret = devm_clk_notifier_register(&pdev->dev, clk_wzrd->axi_clk,
> &clk_wzrd->nb);
[Severity: High]
This is a pre-existing issue, but does this corrupt the SRCU notifier chain?
The exact same notifier_block instance (&clk_wzrd->nb) is registered to two
independent clock notifier chains (clk_in1 and axi_clk). The notifier API links
the structure into a singly-linked list via the 'next' pointer embedded inside
the notifier_block.
Registering the same block twice overwrites the 'next' pointer for the first
chain, which can permanently break the lists and lead to kernel oopses or
infinite loops during traversal.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731072049.957624-1-shubhrajyoti.datta@amd.com?part=2
next prev parent reply other threads:[~2026-07-31 7:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 7:20 [PATCH v3 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
2026-07-31 7:20 ` [PATCH v3 1/8] dt-bindings: clock: clocking-wizard: Add static-config mode support Shubhrajyoti Datta
2026-07-31 7:20 ` [PATCH v3 2/8] clk: clocking-wizard: Do not map the memory for static-config Shubhrajyoti Datta
2026-07-31 7:33 ` sashiko-bot [this message]
2026-07-31 7:20 ` [PATCH v3 3/8] clk: clocking-wizard: Move clk_in1 acquisition before static-config check Shubhrajyoti Datta
2026-07-31 7:33 ` sashiko-bot
2026-07-31 7:20 ` [PATCH v3 4/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
2026-07-31 7:20 ` [PATCH v3 5/8] clk: clocking-wizard: Skip s_axi_aclk for static-config Shubhrajyoti Datta
2026-07-31 7:37 ` sashiko-bot
2026-07-31 7:20 ` [PATCH v3 6/8] clk: clocking-wizard: Use dev_err_probe() when mapping registers Shubhrajyoti Datta
2026-07-31 7:20 ` [PATCH v3 7/8] clk: clocking-wizard: Fix division by zero and unbounded register write Shubhrajyoti Datta
2026-07-31 7:33 ` sashiko-bot
2026-07-31 7:20 ` [PATCH v3 8/8] clk: clocking-wizard: Use separate notifier_block for each clock Shubhrajyoti Datta
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=20260731073332.92D041F000E9@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 \
--cc=shubhrajyoti.datta@amd.com \
/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