diff options
| author | Tony Nguyen <anthony.l.nguyen@intel.com> | 2021-10-07 16:01:58 -0700 |
|---|---|---|
| committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2021-12-14 10:19:14 -0800 |
| commit | c14846914ed6b575752417cf04bc145be15236c1 (patch) | |
| tree | b692810ac658f12a303a1425f2b18cb3e9a94b03 /drivers/net/ethernet/intel/ice/ice_main.c | |
| parent | ice: Remove excess error variables (diff) | |
| download | linux-c14846914ed6b575752417cf04bc145be15236c1.tar.gz linux-c14846914ed6b575752417cf04bc145be15236c1.zip | |
ice: Propagate error codes
As all functions now return standard error codes, propagate the values
being returned instead of converting them to generic values.
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_main.c')
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 68 |
1 files changed, 18 insertions, 50 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 1e2b053332aa..0c425d24889f 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -157,18 +157,13 @@ static int ice_init_mac_fltr(struct ice_pf *pf) { struct ice_vsi *vsi; u8 *perm_addr; - int status; vsi = ice_get_main_vsi(pf); if (!vsi) return -EINVAL; perm_addr = vsi->port_info->mac.perm_addr; - status = ice_fltr_add_mac_and_broadcast(vsi, perm_addr, ICE_FWD_TO_VSI); - if (status) - return -EIO; - - return 0; + return ice_fltr_add_mac_and_broadcast(vsi, perm_addr, ICE_FWD_TO_VSI); } /** @@ -253,10 +248,7 @@ static int ice_set_promisc(struct ice_vsi *vsi, u8 promisc_m) status = ice_fltr_set_vlan_vsi_promisc(&vsi->back->hw, vsi, promisc_m); else status = ice_fltr_set_vsi_promisc(&vsi->back->hw, vsi->idx, promisc_m, 0); - if (status) - return -EIO; - - return 0; + return status; } /** @@ -276,10 +268,7 @@ static int ice_clear_promisc(struct ice_vsi *vsi, u8 promisc_m) status = ice_fltr_clear_vlan_vsi_promisc(&vsi->back->hw, vsi, promisc_m); else status = ice_fltr_clear_vsi_promisc(&vsi->back->hw, vsi->idx, promisc_m, 0); - if (status) - return -EIO; - - return 0; + return status; } /** @@ -356,7 +345,6 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) netdev_warn(netdev, "Reached MAC filter limit, forcing promisc mode on VSI %d\n", vsi->vsi_num); } else { - err = -EIO; goto out; } } @@ -1889,7 +1877,6 @@ static int ice_init_nvm_phy_type(struct ice_port_info *pi) if (err) { dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); - err = -EIO; goto out; } @@ -2005,7 +1992,6 @@ static int ice_init_phy_user_cfg(struct ice_port_info *pi) pcaps, NULL); if (err) { dev_err(ice_pf_to_dev(pf), "Get PHY capability failed.\n"); - err = -EIO; goto err_out; } @@ -2084,7 +2070,6 @@ static int ice_configure_phy(struct ice_vsi *vsi) if (err) { dev_err(dev, "Failed to get PHY configuration, VSI %d error %d\n", vsi->vsi_num, err); - err = -EIO; goto done; } @@ -2106,7 +2091,6 @@ static int ice_configure_phy(struct ice_vsi *vsi) if (err) { dev_err(dev, "Failed to get PHY caps, VSI %d error %d\n", vsi->vsi_num, err); - err = -EIO; goto done; } @@ -2160,11 +2144,9 @@ static int ice_configure_phy(struct ice_vsi *vsi) cfg->caps |= ICE_AQ_PHY_ENA_AUTO_LINK_UPDT | ICE_AQ_PHY_ENA_LINK; err = ice_aq_set_phy_cfg(&pf->hw, pi, cfg, NULL); - if (err) { + if (err) dev_err(dev, "Failed to set phy config, VSI %d error %d\n", vsi->vsi_num, err); - err = -EIO; - } kfree(cfg); done: @@ -3542,10 +3524,8 @@ static int ice_setup_pf_sw(struct ice_pf *pf) INIT_LIST_HEAD(&vsi->ch_list); status = ice_cfg_netdev(vsi); - if (status) { - status = -ENODEV; + if (status) goto unroll_vsi_setup; - } /* netdev has to be configured before setting frame size */ ice_vsi_cfg_frame_size(vsi); @@ -3569,7 +3549,6 @@ static int ice_setup_pf_sw(struct ice_pf *pf) if (status) { dev_err(dev, "Failed to set CPU Rx map VSI %d error %d\n", vsi->vsi_num, status); - status = -EINVAL; goto unroll_napi_add; } status = ice_init_mac_fltr(pf); @@ -5486,13 +5465,11 @@ ice_set_tx_maxrate(struct net_device *netdev, int queue_index, u32 maxrate) else status = ice_cfg_q_bw_lmt(vsi->port_info, vsi->idx, tc, q_handle, ICE_MAX_BW, maxrate * 1000); - if (status) { + if (status) netdev_err(netdev, "Unable to set Tx max rate, error %d\n", status); - return -EIO; - } - return 0; + return status; } /** @@ -6547,7 +6524,7 @@ static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type) if (err) { dev_err(dev, "replay VSI failed, error %d, VSI index %d, type %s\n", err, vsi->idx, ice_vsi_type_str(type)); - return -EIO; + return err; } /* Re-map HW VSI number, using VSI handle that has been @@ -6950,13 +6927,11 @@ int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size) params.lut = lut; status = ice_aq_set_rss_lut(hw, ¶ms); - if (status) { + if (status) dev_err(ice_pf_to_dev(vsi->back), "Cannot set RSS lut, err %d aq_err %s\n", status, ice_aq_str(hw->adminq.sq_last_status)); - return -EIO; - } - return 0; + return status; } /** @@ -6975,13 +6950,11 @@ int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed) return -EINVAL; status = ice_aq_set_rss_key(hw, vsi->idx, (struct ice_aqc_get_set_rss_keys *)seed); - if (status) { + if (status) dev_err(ice_pf_to_dev(vsi->back), "Cannot set RSS key, err %d aq_err %s\n", status, ice_aq_str(hw->adminq.sq_last_status)); - return -EIO; - } - return 0; + return status; } /** @@ -7007,13 +6980,11 @@ int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size) params.lut = lut; status = ice_aq_get_rss_lut(hw, ¶ms); - if (status) { + if (status) dev_err(ice_pf_to_dev(vsi->back), "Cannot get RSS lut, err %d aq_err %s\n", status, ice_aq_str(hw->adminq.sq_last_status)); - return -EIO; - } - return 0; + return status; } /** @@ -7032,13 +7003,11 @@ int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed) return -EINVAL; status = ice_aq_get_rss_key(hw, vsi->idx, (struct ice_aqc_get_set_rss_keys *)seed); - if (status) { + if (status) dev_err(ice_pf_to_dev(vsi->back), "Cannot get RSS key, err %d aq_err %s\n", status, ice_aq_str(hw->adminq.sq_last_status)); - return -EIO; - } - return 0; + return status; } /** @@ -7101,7 +7070,6 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode) if (ret) { dev_err(ice_pf_to_dev(vsi->back), "update VSI for bridge mode failed, bmode = %d err %d aq_err %s\n", bmode, ret, ice_aq_str(hw->adminq.sq_last_status)); - ret = -EIO; goto out; } /* Update sw flags for book keeping */ @@ -7173,7 +7141,7 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, ice_aq_str(hw->adminq.sq_last_status)); /* revert hw->evb_veb */ hw->evb_veb = (pf_sw->bridge_mode == BRIDGE_MODE_VEB); - return -EIO; + return err; } pf_sw->bridge_mode = mode; @@ -8361,7 +8329,7 @@ int ice_open_internal(struct net_device *netdev) err = ice_update_link_info(pi); if (err) { netdev_err(netdev, "Failed to get link info, error %d\n", err); - return -EIO; + return err; } ice_check_link_cfg_err(pf, pi->phy.link_info.link_cfg_err); |
