From: sashiko-bot@kernel.org
To: "Varadarajan Narayanan" <varadarajan.narayanan@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/2] usb: dwc3: qcom: Allow the glue layer to pass ref_clk to the core
Date: Tue, 25 Aug 2026 05:23:27 +0000 [thread overview]
Message-ID: <20260825052327.6BECB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260825-ctrl-v1-2-609e2291814d@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Masking of legitimate errors (like -EPROBE_DEFER or -ENOMEM) from devm_clk_get_optional() by using IS_ERR_OR_NULL().
- [High] Passing ref_clk to the DWC3 core causes a reference count leak that leaves the clock physically enabled during runtime suspend.
- [Low] Spammy dev_info() log on every boot for platforms without the optional clock.
--
--- Patch [2]: [PATCH 2/2] usb: dwc3: qcom: Allow the glue layer to pass ref_clk to the core ---
commit 0c1a156683fd6c3e4e8f63adc608d4af8b20c95e
Author: Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>
usb: dwc3: qcom: Allow the glue layer to pass ref_clk to the core
The dwc3-qcom glue layer sets probe_data.ignore_clocks_and_resets before
calling dwc3_core_probe(), preventing the DWC3 core from acquiring ref_clk.
This patch allows the Qualcomm glue driver to provide ref_clk to the core for
platforms that need it.
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index ac68b4218b56b..2d6de6469c1ea 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -705,6 +705,13 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
> probe_data.res = &res;
> probe_data.ignore_clocks_and_resets = true;
> probe_data.properties = DWC3_DEFAULT_PROPERTIES;
> +
> + qcom->dwc.ref_clk = devm_clk_get_optional(dev, "ref_clk");
[Severity: High]
Does this code leak a clock reference count during runtime suspend?
The glue driver gets and enables all clocks via devm_clk_bulk_get_all(), which
includes ref_clk. By passing ref_clk to the DWC3 core here, dwc3_clk_enable()
will increment the clock's enable count a second time.
During HOST runtime suspend, dwc3_suspend_common() intentionally skips
disabling clocks:
drivers/usb/dwc3/core.c:dwc3_suspend_common() {
...
if (!PMSG_IS_AUTO(msg) &&
(!device_may_wakeup(dwc->dev) || dwc->needs_full_reinit)) {
dwc3_core_exit(dwc);
break;
}
...
}
Because of this, when the glue driver suspends and calls
clk_bulk_disable_unprepare() in dwc3_qcom_suspend(), the enable count for
ref_clk drops from 2 to 1 instead of reaching 0. Will this leave the clock
physically powered on and cause a permanent power management regression?
> + if (IS_ERR_OR_NULL(qcom->dwc.ref_clk)) {
[Severity: High]
Does masking the error return from devm_clk_get_optional() with IS_ERR_OR_NULL
discard legitimate errors?
If the clock provider is not yet ready, devm_clk_get_optional() will return
-EPROBE_DEFER. Masking this error means the driver silently proceeds without the
required clock, leading to incorrect hardware initialization instead of deferring
the probe.
> + qcom->dwc.ref_clk = NULL;
> + dev_info(dev, "NOT setting dwc.ref_clk\n");
[Severity: Low]
Will this dev_info() cause unnecessary log spam on every boot?
When the optional clock is naturally absent from the device tree,
devm_clk_get_optional() returns NULL. This logs unconditionally on platforms
without the optional clock. Could this be removed or changed to dev_dbg to avoid
dmesg spam?
> + }
> +
> ret = dwc3_core_probe(&probe_data);
> if (ret) {
> ret = dev_err_probe(dev, ret, "failed to register DWC3 Core\n");
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260825-ctrl-v1-0-609e2291814d@oss.qualcomm.com?part=2
prev parent reply other threads:[~2026-08-25 5:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 5:08 [PATCH 0/2] Add support for IPQ9650 USB controller Varadarajan Narayanan
2026-08-25 5:08 ` [PATCH 1/2] dt-bindings: usb: qcom,snps-dwc3: Add IPQ9650 compatible Varadarajan Narayanan
2026-08-25 5:08 ` [PATCH 2/2] usb: dwc3: qcom: Allow the glue layer to pass ref_clk to the core Varadarajan Narayanan
2026-08-25 5:23 ` 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=20260825052327.6BECB1F000E9@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=varadarajan.narayanan@oss.qualcomm.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