Re: [PATCH v2] net: dsa: mt7530: fix regulator leak in mt7530_setup()

From: Xiangwu Lai

Date: Mon Nov 23 2026 - 01:40:07 EST


Hi,

On Mon, 23 Nov 2026 06:18:18 +0000, netdev-bot+sashiko wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential
> issue(s) to consider.
>
> - [High] The fix is incomplete: the regulator leak the commit message
> describes can still happen.
> - [Medium] Possible double disable: the new error labels in
> mt7530_setup() disable core_pwr/io_pwr, but mt7530_remove() still...
> - [Low] Possible power-down ordering problem (speculative): the new
> err_powers / err_disable_core_pwr rollback in mt7530_setup() disables...

Thanks for the review. These are the same three issues that were found
in the review of v1 [1], and I agree with all of them for v2 as well:

* High: Correct. The chained error labels only unwind failures inside
mt7530_setup(). mt7530_setup_irq(), mt7530_setup_mdio() (both can
return -EPROBE_DEFER), the SGMII PCS creation and the DSA core setup
steps can still fail with the regulators left enabled, and each
deferred probe retry would leak one more enable.

* Medium: Correct. In a multi-switch tree, a switch can stay bound
without its ds->ops->setup having run; a later failing setup is
reported through the other switch's probe. With the v2 unwinding
bringing the enable count back to zero, the later unbind would then
hit the unbalanced regulator_disable() in mt7530_remove().

* Low: Point taken, it is speculative for a software-only fix, and
mt7530_remove() already disables the regulators in the same order.

v2 has been superseded by v3 [2], which adopts the structure suggested
in the review ("move the enable/disable into a properly paired place,
such as probe with a devm action"):

[PATCH v3] net: dsa: mt7530: manage the core and io regulators with devm actions
https://lore.kernel.org/r/20261123022415.433-1-laixiangwu@xxxxxxxxxxxxxxxxxxxx

The enables now live in mt7530_probe(), each paired with a
devm_add_action_or_reset() callback, mt7530_setup() is back to its
original shape, and mt7530_remove() no longer touches the regulators.
This resolves all three findings: every later failure path (including
-EPROBE_DEFER retries and the bind-without-setup case) is covered by
the devm actions, and there is no second disable anywhere.

pw-bot: cr

[1] https://lore.kernel.org/r/179531318026.3135.909782780821579093@xxxxxxxxxx
[2] https://lore.kernel.org/r/20261123022415.433-1-laixiangwu@xxxxxxxxxxxxxxxxxxxx

Best regards,
Xiangwu Lai