> designware_eth_probe() enables the clocks of the MAC before it enables
> the PHY supply. If regulator_set_enable_if_allowed() fails, or on
> NPCM8xx if setting "phy-supply-microvolt" fails, the probe returns
> directly and skips the clk_release_all() at the end of the function. A
> failed probe does not call designware_eth_remove(), so the clocks are
> left enabled.
>
> Go to the error path instead, as the later failures in the probe do.
> This uses the mdio_err label, because clk_err only exists with
> CONFIG_CLK; nothing between the two labels has been set up yet. The
> PHY supply itself is still left enabled, as on the other error paths
> and in designware_eth_remove().
>
> Fixes: ba1f96672522 ("net: designware: add clock support")
> Fixes: 8897f91a5397 ("net: designware: support phy io micro voltage setting.")
> Signed-off-by: Yuho Choi <[email protected]>
> ---
> Build-tested only, on nanopi-r2s-rk3328 and A20-OLinuXino-Lime2
> (CLK=y, DM_REGULATOR=y), arbel_evb (NPCM8XX) and socfpga_arria10
> (DM_REGULATOR=n), with no new warnings in designware.c at W=1. I also
> compiled designware.c with CONFIG_CLK undefined, since CLK is selected
> on all these boards. Not tested at runtime: I have no board where the
> PHY supply fails.
>
> drivers/net/designware.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Applied to u-boot-net branch for-main [1], thanks!
[1]
https://git.u-boot-project.org/u-boot/custodians/u-boot-net/-/commits/for-main
[1/1] net: designware: Release the clocks if the PHY supply fails
commit: db5a66481335850a00e74932c8993fb5561b83cc
Best regards,
--
Jerome Forissier <[email protected]>