From: sashiko-bot@kernel.org
To: "Adrian Ng Ho Yin" <adrian.ho.yin.ng@altera.com>
Cc: robh@kernel.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/6] clk: socfpga: agilex5: add usb3.1 reference clock
Date: Wed, 12 Aug 2026 07:49:21 +0000 [thread overview]
Message-ID: <20260812074921.8BF7F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <fd7dfb0bfc9fdd0cc68385960d98ae24b2137416.1786518803.git.adrian.ho.yin.ng@altera.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Returning an error from probe after registering non-devm managed clocks leaves dangling pointers to devm-managed I/O memory in the global clock tree.
--
--- Patch [2]: [PATCH v3 2/6] clk: socfpga: agilex5: add usb3.1 reference clock ---
commit 10f11218bd38bd2427f2a47b44a955f750a91676
Author: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
clk: socfpga: agilex5: add usb3.1 reference clock
This commit adds a fixed-factor reference clock for the Agilex5 DWC3
controller so the driver can request each input by name.
> diff --git a/drivers/clk/socfpga/clk-agilex5.c b/drivers/clk/socfpga/clk-agilex5.c
> index f7f0ad884f645..af3009ddc6ab3 100644
> --- a/drivers/clk/socfpga/clk-agilex5.c
> +++ b/drivers/clk/socfpga/clk-agilex5.c
> @@ -526,6 +526,21 @@ static int agilex5_clkmgr_init(struct platform_device *pdev)
> agilex5_clk_register_gate(agilex5_gate_clks,
> ARRAY_SIZE(agilex5_gate_clks), clk_data);
>
> + /*
> + * usb31_ref_clk is a 1:1 alias of usb31_suspend_clk. The DWC3
> + * controller uses the same source for both its suspend and reference
> + * clock inputs on this SoC. Register it as a fixed-factor (passthrough)
> + * clock so that enabling it propagates to the parent gate without
> + * touching any gate register of its own.
> + */
> + clk_data->clk_data.hws[AGILEX5_USB31_REF_CLK] =
> + devm_clk_hw_register_fixed_factor(dev, "usb31_ref_clk",
> + "usb31_suspend_clk", 0, 1, 1);
> + if (IS_ERR(clk_data->clk_data.hws[AGILEX5_USB31_REF_CLK]))
> + return dev_err_probe(dev,
> + PTR_ERR(clk_data->clk_data.hws[AGILEX5_USB31_REF_CLK]),
> + "failed to register clock usb31_ref_clk\n");
[Severity: High]
If devm_clk_hw_register_fixed_factor() fails and we return an error here,
will this leave dangling pointers in the Common Clock Framework?
The previous clocks registered earlier in agilex5_clkmgr_init() (like PLLs
and gates) are registered globally without devm management. Since clk_data
and the IO memory base are devm-managed, returning an error from probe
causes them to be freed and unmapped.
Could this cause the system to crash due to unmapped memory access when the
clock framework later accesses these dangling clocks (for example, during
clk_disable_unused())?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1786518803.git.adrian.ho.yin.ng@altera.com?part=2
next prev parent reply other threads:[~2026-08-12 7:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 7:32 [PATCH v3 0/6] Add USB3.1 support for Agilex5 Adrian Ng Ho Yin
2026-08-12 7:32 ` [PATCH v3 1/6] dt-bindings: clock: agilex5: Add USB3.1 reference clock ID Adrian Ng Ho Yin
2026-08-12 11:26 ` Krzysztof Kozlowski
2026-08-12 7:32 ` [PATCH v3 2/6] clk: socfpga: agilex5: add usb3.1 reference clock Adrian Ng Ho Yin
2026-08-12 7:49 ` sashiko-bot [this message]
2026-08-12 7:32 ` [PATCH v3 3/6] dt-bindings: usb: add Altera Agilex5 DWC3 controller Adrian Ng Ho Yin
2026-08-12 7:55 ` sashiko-bot
2026-08-12 11:32 ` Krzysztof Kozlowski
2026-08-12 7:32 ` [PATCH v3 4/6] arm64: dts: intel: agilex5: add USB3.1 controller node Adrian Ng Ho Yin
2026-08-12 7:53 ` sashiko-bot
2026-08-12 7:32 ` [PATCH v3 5/6] arm64: dts: intel: agilex5: remove usb0 in Agilex5 SoCDK Adrian Ng Ho Yin
2026-08-12 7:32 ` [PATCH v3 6/6] usb: dwc3: add Altera Agilex5 support to generic platform driver Adrian Ng Ho Yin
2026-08-12 11:27 ` [PATCH v3 0/6] Add USB3.1 support for Agilex5 Krzysztof Kozlowski
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=20260812074921.8BF7F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=adrian.ho.yin.ng@altera.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-clk@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.