From: Anirudh Venkataramanan Date: Tue, 2 Mar 2021 18:12:09 +0000 (-0800) Subject: ice: Check for bail out condition early X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=805f980bfe0e7d07cd4cd5d1183722f0355c0f4a;p=uclinux-h8%2Flinux.git ice: Check for bail out condition early Check for bail out condition before calling ice_aq_sff_eeprom Signed-off-by: Anirudh Venkataramanan Tested-by: Tony Brelinski Signed-off-by: Tony Nguyen --- diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 4f738425fb44..109dd6962b1d 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -3926,14 +3926,14 @@ ice_get_module_eeprom(struct net_device *netdev, u8 value = 0; u8 page = 0; - status = ice_aq_sff_eeprom(hw, 0, addr, offset, page, 0, - &value, 1, 0, NULL); - if (status) - return -EIO; - if (!ee || !ee->len || !data) return -EINVAL; + status = ice_aq_sff_eeprom(hw, 0, addr, offset, page, 0, &value, 1, 0, + NULL); + if (status) + return -EIO; + if (value == ICE_MODULE_TYPE_SFP) is_sfp = true;