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

From: Andrew Lunn

Date: Wed Nov 18 2026 - 18:36:53 EST


> Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")

Does this bother anybody?

https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

> +err_disable_core_pwr:
> + regulator_disable(priv->core_pwr);
> + return ret;
> +
> +err_powers:
> + if (priv->id == ID_MT7530) {
> + regulator_disable(priv->io_pwr);
> + regulator_disable(priv->core_pwr);
> + }
> + return ret;

It is unusual to have two different goto labels with return. Normally
cleanup is structured similar to the code which went wrong.

So something like:

> +err_powers:
> + if (priv->id == ID_MT7530)
> + regulator_disable(priv->io_pwr);
> +err_disable_core_pwr:
> + if (priv->id == ID_MT7530)
> + regulator_disable(priv->core_pwr);
> + return ret;


Andrew

---
pw-bot: cr