From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Votokina Victoria <Victoria.Votokina@kaspersky.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Roger Quadros <rogerq@kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>
Subject: Re: [PATCH] usb: dwc3: am62: handle usb2_refclk enable failures
Date: Tue, 10 Feb 2026 00:30:36 +0000 [thread overview]
Message-ID: <20260210003034.twbkgavdegwlnsvo@synopsys.com> (raw)
In-Reply-To: <20260204141131.2451382-1-Victoria.Votokina@kaspersky.com>
On Wed, Feb 04, 2026, Votokina Victoria wrote:
> The AM62 DWC3 glue enables usb2_refclk via clk_prepare_enable(), but
> the return value was ignored in the init path. If the clock cannot be
> enabled (including -EPROBE_DEFER), the driver continues and may access
> the controller/PHY in an undefined state.
What's the actual error here that you encountered? Or is this a
hypothesis/static check?
>
> Also check dwc3_ti_init() return value on resume when power/context was
> lost.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 31d500c2d0d4 ("usb: dwc3: dwc3-am62: Re-initialize controller if lost power in PM suspend")
> Signed-off-by: Votokina Victoria <Victoria.Votokina@kaspersky.com>
> ---
> drivers/usb/dwc3/dwc3-am62.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
> index e11d7643f966..d8b35098e921 100644
> --- a/drivers/usb/dwc3/dwc3-am62.c
> +++ b/drivers/usb/dwc3/dwc3-am62.c
> @@ -205,7 +205,9 @@ static int dwc3_ti_init(struct dwc3_am62 *am62)
>
> dwc3_ti_writel(am62, USBSS_PHY_CONFIG, reg);
>
> - clk_prepare_enable(am62->usb2_refclk);
> + ret = clk_prepare_enable(am62->usb2_refclk);
> + if (ret)
> + return dev_err_probe(am62->dev, ret, "failed to enable usb2_refclk\n");
>
> /* Set mode valid bit to indicate role is valid */
> reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL);
> @@ -361,14 +363,17 @@ static int dwc3_ti_resume_common(struct device *dev)
> {
> struct dwc3_am62 *am62 = dev_get_drvdata(dev);
> u32 reg;
> + int ret;
>
> reg = dwc3_ti_readl(am62, USBSS_DEBUG_CFG);
> if (reg != USBSS_DEBUG_CFG_DISABLED) {
> /* lost power/context */
> - dwc3_ti_init(am62);
> + return dwc3_ti_init(am62);
This changes the current logic. This is wrong. How did you test this.
> } else {
> + ret = clk_prepare_enable(am62->usb2_refclk);
> + if (ret)
> + return ret;
> dwc3_ti_writel(am62, USBSS_DEBUG_CFG, USBSS_DEBUG_CFG_OFF);
> - clk_prepare_enable(am62->usb2_refclk);
This does more than what's described in the commit. Please explain.
BR,
Thinh
> }
>
> if (device_may_wakeup(dev)) {
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-02-10 0:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 14:11 Votokina Victoria
2026-02-10 0:30 ` Thinh Nguyen [this message]
2026-02-10 9:36 ` Votokina Victoria
2026-02-10 10:15 ` Greg KH
2026-02-14 0:07 ` Thinh Nguyen
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=20260210003034.twbkgavdegwlnsvo@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=Victoria.Votokina@kaspersky.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=rogerq@kernel.org \
/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
all inboxes | Powered by JetHome®