mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guangshuo Li" <lgs201920130244@gmail.com>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH] usb: dwc3: meson-g12a: disable VBUS regulator on remove
Date: Thu, 24 Sep 2026 11:12:58 +0000	[thread overview]
Message-ID: <20260924111258.D01F51F0089E@smtp.kernel.org> (raw)
In-Reply-To: <20260924110429.1557653-1-lgs201920130244@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] usb: dwc3: unbalanced regulator disable in remove path
--

commit d70a1dbc4058328dc13b49feab6a18162b728570
Author: Guangshuo Li <lgs201920130244@gmail.com>

usb: dwc3: meson-g12a: disable VBUS regulator on remove

This commit disables priv->vbus in the remove path before rearming the reset
control to match the cleanup performed by the probe error path.

> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index 4d611c08e8a4c..7ca6fb89027f6 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
> @@ -851,6 +851,9 @@ static void dwc3_meson_g12a_remove(struct platform_device *pdev)
>  	pm_runtime_put_noidle(dev);
>  	pm_runtime_set_suspended(dev);
>  
> +	if (priv->vbus)
> +		regulator_disable(priv->vbus);

[Severity: High]
Could this lead to an unbalanced regulator disable if the device is currently
in device mode?

If the device is operating in OTG mode and transitions to PHY_MODE_USB_DEVICE,
dwc3_meson_g12a_otg_mode_set() already actively disables the regulator:

dwc3_meson_g12a_otg_mode_set() {
    ...
    if (mode == PHY_MODE_USB_DEVICE)
        ret = regulator_disable(priv->vbus);
    ...
}

If dwc3_meson_g12a_remove() is called while the device is still in device mode,
wouldn't this unconditional regulator_disable() drop the enable count below
zero?

> +
>  	reset_control_rearm(priv->reset);
>  
>  	clk_bulk_disable_unprepare(priv->drvdata->num_clks,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260924110429.1557653-1-lgs201920130244@gmail.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

      reply	other threads:[~2026-09-24 11:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 11:04 Guangshuo Li
2026-09-24 11:12 ` 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=20260924111258.D01F51F0089E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.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 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®