Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] mt753x_teardown() (drivers/net/dsa/mt7530.c) now turns off the MT7530 core and io regulators (regulator_disable(priv->core_pwr) /… -- net: dsa: mt7530: disable regulators on switch teardown This moves the MT7530 core and io regulator disable from mt7530_remove() to mt753x_teardown(), after the stats polling work is cancelled. The aim is to turn off the regulators of a switch that is torn down because a sibling in a multi-switch tree failed setup.
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index d5a199293f78a..c2f12ae2c6d7b 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -3237,9 +3237,22 @@ 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); > + } > }
[Severity: Low] Is it safe to cut power here while resources registered by mt753x_setup() are still live? stats_work is the only thing stopped before the regulators go off. The regmap IRQ chip, the internal MDIO bus and the GPIO controller are all devm-managed. They are only released when the driver unbinds: mt7530_setup_irq(): ret = devm_regmap_add_irq_chip_fwnode(dev, dev_fwnode(dev), priv->regmap, irq, ... mt7530_setup_mdio(): ret = devm_of_mdiobus_register(dev, bus, mnp); mt7530_setup_gpio(): return devm_gpiochip_add_data(dev, gc, priv); The commit message describes a case where a sibling switch fails setup and the tree is torn down: dsa_tree_setup() dsa_tree_teardown_switches() dsa_switch_teardown() ds->ops->teardown() mt753x_teardown() Here the MT7530 probe has already returned 0, so mt7530_remove() never runs. The device stays bound and the chip has no power, but the parent IRQ handler, the MDIO bus (mt753x_phy_read_c22() and related accessors) and the GPIO chip are all still registered. Before this patch the rails stayed on in this state. mt7530_setup_irq() sets TOP_SIG_CTRL_NORMAL so the chip drives its INT pin. If that line floats or reads as asserted after power is removed, regmap_irq_thread() would read and ack MT7530_SYS_INT_STS over MDIO on an unpowered device. The nested PHY IRQs were already freed during port teardown. Could this keep returning IRQ_NONE until the IRQ core reports "nobody cared" and disables the line? Anything still using the GPIO chip (for example gpio-leds on the switch LED pins) would also read garbage or have its writes lost. The commit message gives this reason for the ordering: "after the stats polling work is cancelled so that no poll can run against an unpowered switch" That covers stats_work, but not the IRQ thread, the MDIO bus or the GPIO chip. Setup powers the chip on and then registers these. Teardown powers it off while they are still registered. A later patch in the series, "net: dsa: mt7530: register the GPIO controller last in setup", says the GPIO controller must not stay registered across a powered-off failed setup. The same state seems to exist after teardown here. The final patch in the series, "net: dsa: mt7530: disable regulators on mt753x_setup() failure", moves the disable into sw_teardown() but keeps the same order. So this seems to still be present at the end of the series.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/1796…%40mail.zgclab.edu.cn