# \[PATCH net 2/5\] net: dsa: mt7530: factor out mt7530\_disable\_pwrs()

- From: Haoran Wang \<hidden\>
- Date: 2026-11-24 08:27:26 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/11/18010633
- Thread: https://ratatoskr.run/netdev/2026/11/18010629/t.md

```text
Pull the regulator disable out of mt753x_teardown() into a helper so it
can also be used on the setup error paths added in later patches.

The helper stops reporting regulator_disable() failures. A failed
disable on a teardown or error path is not actionable, and on the error
paths the failure being handled is already reported, so the extra
messages would only add noise.

Signed-off-by: Haoran Wang <redacted>
---
 drivers/net/dsa/mt7530.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index c2f12ae2c6d7..eb55cc969f43 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -2376,6 +2376,16 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
 	return ret;
 }
 
+static void
+mt7530_disable_pwrs(struct mt7530_priv *priv)
+{
+	if (priv->id != ID_MT7530)
+		return;
+
+	regulator_disable(priv->core_pwr);
+	regulator_disable(priv->io_pwr);
+}
+
 static int
 mt7530_setup(struct dsa_switch *ds)
 {
@@ -3237,22 +3247,11 @@ static void
 mt753x_teardown(struct dsa_switch *ds)
 {
 	struct mt7530_priv *priv = ds->priv;
-	int ret;
 
 	if (priv->bus)
 		cancel_delayed_work_sync(&priv->stats_work);
 
-	if (priv->id == ID_MT7530) {
-		ret = regulator_disable(priv->core_pwr);
-		if (ret < 0)
-			dev_err(priv->dev,
-				"Failed to disable core power: %d\n", ret);
-
-		ret = regulator_disable(priv->io_pwr);
-		if (ret < 0)
-			dev_err(priv->dev, "Failed to disable io pwr: %d\n",
-				ret);
-	}
+	mt7530_disable_pwrs(priv);
 }
 
 static int mt753x_set_mac_eee(struct dsa_switch *ds, int port,

```
