summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2021-06-08 16:10:37 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-08 16:31:25 -0700
commitb55b1d50b08ce3b79329f62da8104b25c607bf38 (patch)
treec8adb6cc770ce590a6b2ea91d1fc359b00226838 /drivers/net/ethernet/stmicro
parente83332842a46c091992ad06145b5c1b65a08ab05 (diff)
downloadlinux-b55b1d50b08ce3b79329f62da8104b25c607bf38.tar.bz2
net: stmmac: fix NPD with phylink_set_pcs if there is no MDIO bus
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") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1b12a2f8bfb5..f2adff59b07d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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;