]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: txgbe: fix null pointer to pcs
authorJiawen Wu <jiawenwu@trustnetic.com>
Fri, 15 Nov 2024 07:35:08 +0000 (15:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:53:28 +0000 (13:53 +0100)
[ Upstream commit 2160428bcb20f2f70a72ee84aba91a1264dc4ff3 ]

For 1000BASE-X or SGMII interface mode, the PCS also need to be selected.
Only return null pointer when there is a copper NIC with external PHY.

Fixes: 02b2a6f91b90 ("net: txgbe: support copper NIC with external PHY")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Link: https://patch.msgid.link/20241115073508.1130046-1-jiawenwu@trustnetic.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c

index 119cbd34660117e40c4c7aaac5612b0abb80af46..654491053589847cad126ed05ffc3d592425f341 100644 (file)
@@ -162,7 +162,7 @@ static struct phylink_pcs *txgbe_phylink_mac_select(struct phylink_config *confi
        struct wx *wx = phylink_to_wx(config);
        struct txgbe *txgbe = wx->priv;
 
-       if (interface == PHY_INTERFACE_MODE_10GBASER)
+       if (wx->media_type != sp_media_copper)
                return &txgbe->xpcs->pcs;
 
        return NULL;