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

Haoran Wang wanghr2026 at mail.zgclab.edu.cn
Tue Nov 24 00:25:57 PST 2026


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(-)




More information about the linux-arm-kernel mailing list