]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link
authorDinh Nguyen <dinguyen@kernel.org>
Thu, 7 Apr 2022 13:25:21 +0000 (08:25 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Apr 2022 09:41:00 +0000 (10:41 +0100)
commitde8c069a306457a04e784473de120df41c231157
tree788496758870c83f17a5a0a54aa9b16adf823d52
parent4798e8caa9f757cd82dda43541140dd8f2a81df8
net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link

When using a fixed-link, the altr_tse_pcs driver crashes
due to null-pointer dereference as no phy_device is provided to
tse_pcs_fix_mac_speed function. Fix this by adding a check for
phy_dev before calling the tse_pcs_fix_mac_speed() function.

Also clean up the tse_pcs_fix_mac_speed function a bit. There is
no need to check for splitter_base and sgmii_adapter_base
because the driver will fail if these 2 variables are not
derived from the device tree.

Fixes: 7ada02d00bd4 ("net: ethernet: Add TSE PCS support to dwmac-socfpga")
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c