* [PATCH] usb: dwc3: meson-g12a: disable VBUS regulator on remove
@ 2026-09-24 11:04 Guangshuo Li
2026-09-24 11:12 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-09-24 11:04 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh, neil.armstrong, khilman
Cc: linux-usb, linux-arm-kernel, linux-amlogic, linux-kernel,
jbrunet, martin.blumenstingl, felipe.balbi, lgs201920130244
dwc3_meson_g12a_probe() enables priv->vbus when the optional regulator is
present, but dwc3_meson_g12a_remove() does not perform the matching
regulator_disable(). The probe error path already disables the regulator
before rearming the reset control.
Disable priv->vbus in the remove path before reset_control_rearm() to
match the cleanup performed by the probe error path.
Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/usb/dwc3/dwc3-meson-g12a.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index 4d611c08e8a4..7ca6fb89027f 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);
+
reset_control_rearm(priv->reset);
clk_bulk_disable_unprepare(priv->drvdata->num_clks,
base-commit: f03c39de3a1307371a4032757cd1732e91087c7d
--
2.43.0
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: dwc3: meson-g12a: disable VBUS regulator on remove
2026-09-24 11:04 [PATCH] usb: dwc3: meson-g12a: disable VBUS regulator on remove Guangshuo Li
@ 2026-09-24 11:12 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-09-24 11:12 UTC (permalink / raw)
To: Guangshuo Li; +Cc: linux-amlogic, neil.armstrong
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-24 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 11:04 [PATCH] usb: dwc3: meson-g12a: disable VBUS regulator on remove Guangshuo Li
2026-09-24 11:12 ` sashiko-bot
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®