]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:42:16 +0000 (14:42 +0200)
commit56ce35c6371ccb345c50d0ff90d14b92478a305d
treeabe0851b980c2f9b82110b773f98338396aa494b
parent9cbd1137ec0b3962e52338ff9173072621c1f788
net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link

BugLink: https://bugs.launchpad.net/bugs/1969857
[ Upstream commit a6aaa00324240967272b451bfa772547bd576ee6 ]

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: fb3bbdb85989 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
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