From: Maxime Chevallier Date: Fri, 21 Mar 2025 10:35:01 +0000 (+0100) Subject: net: stmmac: Call xpcs_config_eee_mult_fact() only when xpcs is present X-Git-Tag: v6.15-rc1~160^2~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53cd6820f5a05dd7f982f7da85af7d185b3e4992;p=thirdparty%2Fkernel%2Flinux.git net: stmmac: Call xpcs_config_eee_mult_fact() only when xpcs is present Some dwmac variants such as dwmac_socfpga don't use xpcs but lynx_pcs. Don't call xpcs_config_eee_mult_fact() in this case, as this causes a crash at init : Unable to handle kernel NULL pointer dereference at virtual address 00000039 when write [...] Call trace: xpcs_config_eee_mult_fact from stmmac_pcs_setup+0x40/0x10c stmmac_pcs_setup from stmmac_dvr_probe+0xc0c/0x1244 stmmac_dvr_probe from socfpga_dwmac_probe+0x130/0x1bc socfpga_dwmac_probe from platform_probe+0x5c/0xb0 Fixes: 060fb27060e8 ("net: stmmac: call xpcs_config_eee_mult_fact()") Signed-off-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) Link: https://patch.msgid.link/20250321103502.1303539-1-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 7c0a4046bbe35..836f2848dfeb8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -524,7 +524,8 @@ int stmmac_pcs_setup(struct net_device *ndev) if (ret) return dev_err_probe(priv->device, ret, "No xPCS found\n"); - xpcs_config_eee_mult_fact(xpcs, priv->plat->mult_fact_100ns); + if (xpcs) + xpcs_config_eee_mult_fact(xpcs, priv->plat->mult_fact_100ns); priv->hw->xpcs = xpcs;