Re: [PATCH net v3 1/5] net: phy: split phy_probe() error paths
From: Andrew Lunn
Date: Wed Aug 19 2026 - 09:35:58 EST
On Wed, Aug 19, 2026 at 02:02:32PM +0800, Xuanqiang Luo wrote:
> From: Xuanqiang Luo <luoxuanqiang@xxxxxxxxxx>
>
> phy_probe() uses one cleanup path for failures at every initialization
> stage. This runs cleanup for resources that have not been initialized.
>
> Split the cleanup by initialization stage so each failure path unwinds
> only the resources that may have been initialized.
> -out:
> +out_unreg_led_triggers:
> + if (!phydev->is_on_sfp_module)
> + phy_led_triggers_unregister(phydev);
> +
> +out_sfp_release:
> sfp_bus_del_upstream(phydev->sfp_bus);
> phydev->sfp_bus = NULL;
>
> phy_cleanup_ports(phydev);
>
> - if (!phydev->is_on_sfp_module)
> - phy_led_triggers_unregister(phydev);
> -
It would be nice to mention this reorder in the commit message. The
commit message is about "Why?". Explain why the order has been
changed.
Andrew
---
pw-bot: cr