From: sashiko-bot@kernel.org
To: "Radhey Shyam Pandey" <radhey.shyam.pandey@amd.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH] dt-bindings: usb: xlnx,usb2: Make clocks required
Date: Mon, 10 Aug 2026 15:57:05 +0000 [thread overview]
Message-ID: <20260810155706.378DC1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260810154548.2133565-1-radhey.shyam.pandey@amd.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Medium] Making `clocks` and `clock-names` unconditionally required breaks backward compatibility for older device trees.
Pre-existing issues:
- [High] devm_request_irq is called before read_fn, write_fn, and spinlock are initialized, risking a NULL pointer dereference.
- [High] Device clock is disabled before the devm-managed IRQ is freed, causing a potential bus fault if an interrupt fires.
--
--- Patch [1]: [PATCH] dt-bindings: usb: xlnx,usb2: Make clocks required ---
commit e81394ee7d6f7bd713fd2fe198723a128037fcee
Author: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
dt-bindings: usb: xlnx,usb2: Make clocks required
Add s_axi_aclk AXI4 clock support as a required property. Traditionally this IP
was used on MicroBlaze platforms which had fixed clocks enabled all the time.
But since it is a PL IP, it can also be used on SoC platforms like Zynq
UltraScale+ MPSoC where it is mandatory to explicitly enable IP clocks.
> diff --git a/Documentation/devicetree/bindings/usb/xlnx,usb2.yaml b/Documentation/devicetree/bindings/usb/xlnx,usb2.yaml
> index f295aa9d9ee79..156d3676f9f99 100644
> --- a/Documentation/devicetree/bindings/usb/xlnx,usb2.yaml
> +++ b/Documentation/devicetree/bindings/usb/xlnx,usb2.yaml
> @@ -34,6 +34,8 @@ required:
> - compatible
> - reg
> - interrupts
> + - clocks
> + - clock-names
[Severity: Medium]
Will this break backward compatibility for older device trees? The commit
message mentions this IP was traditionally used on MicroBlaze platforms which
had fixed clocks enabled and likely omitted these properties. Making them
unconditionally required will cause existing, valid legacy device trees to fail
schema validation.
>
> additionalProperties: false
[ ... ]
[Severity: High]
This is a pre-existing issue, but is there a risk of a null pointer dereference
during probe?
In drivers/usb/gadget/udc/udc-xilinx.c:xudc_probe(), devm_request_irq() is
called before read_fn, write_fn, and the spinlock are initialized:
drivers/usb/gadget/udc/udc-xilinx.c:xudc_probe() {
...
ret = devm_request_irq(&pdev->dev, irq, xudc_irq, 0,
dev_name(&pdev->dev), udc);
...
/* initialized later */
udc->read_fn = ...
udc->write_fn = ...
}
If an interrupt fires immediately after devm_request_irq() returns, the
xudc_irq() handler will execute and attempt to use the uninitialized spinlock
and udc->read_fn(), potentially crashing the kernel.
[Severity: High]
This is a pre-existing issue, but does disabling the clock before the interrupt
is freed introduce a potential bus fault?
In drivers/usb/gadget/udc/udc-xilinx.c:xudc_remove() and the probe error path,
clk_disable_unprepare() is called on the device clock:
drivers/usb/gadget/udc/udc-xilinx.c:xudc_remove() {
...
clk_disable_unprepare(udc->clk);
...
}
Because the interrupt is managed by devm_request_irq(), it remains active until
the devres cleanup runs after the function returns. If a late interrupt triggers
in this window, xudc_irq() will attempt to access hardware registers with the
clock disabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260810154548.2133565-1-radhey.shyam.pandey@amd.com?part=1
prev parent reply other threads:[~2026-08-10 15:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 15:45 [PATCH] dt-bindings: usb: xlnx,usb2: Make clocks required Radhey Shyam Pandey
2026-08-10 15:57 ` sashiko-bot [this message]
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=20260810155706.378DC1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=radhey.shyam.pandey@amd.com \
--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.