Skip to contentSkip to conversation

ixgbe: add error checks when initializing the PHY

PATCH New Emil Tantilov 2 participants 2 messages Aug 18, 2017 – Aug 28, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe: add error checks when initializing the PHY

Ignoring errors when attempting to identify the PHY can lead to a crash. Specifically in the case of FW controlled PHYs where the PHY read/write operations are set to NULL.

Removed redundant comment.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +6 -2
index 11c0378..1974f8f 100644
@@ -3292,6 +3292,9 @@ static s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 
 	/* Identify the PHY or SFP module */
 	ret_val = phy->ops.identify(hw);
+	if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED ||
+	    ret_val == IXGBE_ERR_PHY_ADDR_INVALID)
+		return ret_val;
 
 	/* Setup function pointers based on detected hardware */
 	ixgbe_init_mac_link_ops_X550em(hw);
@@ -3494,9 +3497,10 @@ static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw)
 	ixgbe_clear_tx_pending(hw);
 
 	/* PHY ops must be identified and initialized prior to reset */
-
-	/* Identify PHY and related function pointers */
 	status = hw->phy.ops.init(hw);
+	if (status == IXGBE_ERR_SFP_NOT_SUPPORTED ||
+	    status == IXGBE_ERR_PHY_ADDR_INVALID)
+		return status;
 
 	/* start the external PHY */
 	if (hw->phy.type == ixgbe_phy_x550em_ext_t) {
#1 lore raw

PATCH 1/1 ixgbe: add error checks when initializing the PHY

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Emil Tantilov
Sent: Friday, August 18, 2017 3:48 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] ixgbe: add error checks when initializing the PHY

Ignoring errors when attempting to identify the PHY can lead to a crash. Specifically in the case of FW controlled PHYs where the PHY read/write operations are set to NULL.

Quoted 6 lines

Removed redundant comment.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)