Re: [PATCH net-next] net: stmmac: dwmac-sun8i: Defer probe when the EPHY clock is not ready

From: Maxime Chevallier

Date: Tue Nov 17 2026 - 04:35:36 EST


Hi,

On 11/17/26 09:13, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 1 · Medium: 0 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [High] The patch makes get_ephy_nodes() in
> drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c return -EPROBE_DEFER…
>
> --
>
> net: stmmac: dwmac-sun8i: Defer probe when the EPHY clock is not ready
>
> With this patch, get_ephy_nodes() returns -EPROBE_DEFER when of_clk_get()
> on the internal PHY node returns -EPROBE_DEFER. Before, it skipped the
> node and the probe ended with -ENODEV. Other clock errors still skip the
> node.
>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
>> index 2ece7ba9dd73b..8163e49fa7ad0 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
>> @@ -801,8 +801,13 @@ static int get_ephy_nodes(struct stmmac_priv *priv)
>> struct clk *ephy_clk;
>>
>> ephy_clk = of_clk_get(iphynode, 0);
>> - if (IS_ERR(ephy_clk))
>> + if (IS_ERR(ephy_clk)) {
>> + if (PTR_ERR(ephy_clk) == -EPROBE_DEFER) {
>> + of_node_put(mdio_internal);
>> + return -EPROBE_DEFER;
>> + }
>> continue;
>> + }
>> gmac->rst_ephy = of_reset_control_get_exclusive(iphynode, NULL);
>> if (IS_ERR(gmac->rst_ephy)) {
>> ret = PTR_ERR(gmac->rst_ephy);
>
> [Severity: High]
> Does this deferral come too late in the probe?
I agree with the bot here, this defer happens after the netdev is registered,
which isn't great... And it's likely the PHY is on that mux'd bus, no ?

Was this tested ? Doesn't it really work to return a probedefer so late ?

This mdio mux logic should likely be reworked so that we register the mux in due
time (i.e during the mdio init sequence, may be by hooking into stmmac_mdio_setup
or something like that ?)

Maxime