Thread (7 messages) 7 messages, 3 authors, 23d ago

Re: [PATCHv2 1/2] usb: bcma: add regulator support

flat view

From: sashiko-bot@kernel.org
Date: 2026-09-21 21:51:41

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] usb: bcma: teardown ordering violation in bcma_hcd_remove()
--

commit cdbc43989b0d2d3446fd86aaaa77bbc9306cb391
Author: Rosen Penev [off-list ref]

usb: bcma: add regulator support

This patch adds support for the standard regulator interface to provide
VBUS supply to the USB cores. It reference-counts the enable/disable
requests, allowing both controllers to drive one GPIO without conflicts.
quoted hunk ↗ jump to hunk
diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c
index 519386255886c..0d5a220b69880 100644
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -442,6 +464,8 @@ static void bcma_hcd_remove(struct bcma_device *dev)
 	struct platform_device *ohci_dev = usb_dev->ohci_dev;
 	struct platform_device *ehci_dev = usb_dev->ehci_dev;
 
+	regulator_disable(usb_dev->regulator);
+
[Severity: High]
Does disabling the regulator before unregistering the platform devices cause
a teardown ordering violation?

In bcma_hcd_probe(), the initialization order is followed: the regulator
is enabled first, and then the child platform devices (ohci_dev and ehci_dev)
are registered.

During driver teardown in bcma_hcd_remove(), this order must be reversed to
ensure that dependent drivers are unbound while the hardware remains powered.

When platform_device_unregister() runs, it invokes the child drivers' remove
routines (e.g., ehci_platform_remove()), which perform register accesses to
cleanly halt the controllers. Since the regulator (which may power the PHY
or controller logic) has already been disabled here, will these register
accesses target unpowered hardware and trigger synchronous bus errors?

Should the regulator be disabled after the child devices are unregistered?
 	if (ohci_dev)
 		platform_device_unregister(ohci_dev);
 	if (ehci_dev)
 		platform_device_unregister(ehci_dev);
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921214133.16519-2-rosenp@gmail.com?part=1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help