[PATCH net 0/5] net: dsa: mt7530: fix regulator disable on teardown and error paths

From
Haoran Wang <hidden>
Date
2026-11-24 08:27:16
Also in
linux-arm-kernel, linux-mediatek, lkml
mt7530_setup() enables the core and io regulators, but they were not
always disabled again:

 - the disable lived in the driver's remove() callback instead of the
   matching teardown callback, so a switch whose sibling failed to set
   up was torn down without reaching remove() and kept its regulators
   enabled, and

 - the error paths in mt7530_setup() and mt753x_setup() returned without
   disabling the regulators, leaving the rails enabled and making the
   regulator core warn when devres later put an enabled regulator. The
   common case is mt7530_setup_irq() returning -EPROBE_DEFER, which
   re-enabled the rails on every re-probe.

This series splits the original patch into five small, independently
obvious changes, as requested by Andrew Lunn:

  1. Move the disable from remove() to teardown().
  2. Factor the disable into mt7530_disable_pwrs().
  3. Register the GPIO controller last so it is not published across a
     failed setup.
  4. Disable the regulators on every mt7530_setup() error path.
  5. Do the same for mt753x_setup(), moving the mdio irq teardown to the
     end.


Haoran Wang (5):
  net: dsa: mt7530: disable regulators on switch teardown
  net: dsa: mt7530: factor out mt7530_disable_pwrs()
  net: dsa: mt7530: register the GPIO controller last in setup
  net: dsa: mt7530: disable regulators on setup failure
  net: dsa: mt7530: disable regulators on mt753x_setup() failure

 drivers/net/dsa/mt7530-mdio.c | 14 +-------
 drivers/net/dsa/mt7530.c      | 60 +++++++++++++++++++++++++----------
 2 files changed, 45 insertions(+), 29 deletions(-)
Thread (15 messages) 15 messages, 4 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help