Skip to contentSkip to conversation

net: stmmac: fix NPD with phylink_set_pcs if there is no MDIO bus

PATCH New Vladimir Oltean 1 participant 1 message Jun 8, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: fix NPD with phylink_set_pcs if there is no MDIO bus

From: Vladimir Oltean <[email protected]>

priv->plat->mdio_bus_data is optional, some platforms may not set it, however we proceed to look straight at priv->plat->mdio_bus_data->has_xpcs.

Since the xpcs is instantiated based on the has_xpcs property, we can avoid looking at the priv->plat->mdio_bus_data structure altogether and just check for the presence of the xpcs pointer.

Fixes 11059740e616 ("net: pcs: xpcs: convert to phylink_pcs_ops")
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -5
index dd2fb851c693..ec060ce9bcf2 100644
@@ -1238,11 +1238,8 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
 	if (IS_ERR(phylink))
 		return PTR_ERR(phylink);
 
-	if (mdio_bus_data->has_xpcs) {
-		struct mdio_xpcs_args *xpcs = priv->hw->xpcs;
-
-		phylink_set_pcs(phylink, &xpcs->pcs);
-	}
+	if (priv->hw->xpcs)
+		phylink_set_pcs(phylink, &priv->hw->xpcs->pcs);
 
 	priv->phylink = phylink;
 	return 0;
Signature · 1 line
2.25.1