Commit 2ccc1c1c authored by Tony Nguyen's avatar Tony Nguyen
Browse files

ice: Remove excess error variables



ice_status previously had a variable to contain these values where other
error codes had a variable as well. With ice_status now being an int,
there is no need for two variables to hold error values. In cases where
this occurs, remove one of the excess variables and use a single one.
Some initialization of variables are no longer needed and have been
removed.

Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: default avatarGurucharan G <gurucharanx.g@intel.com>
parent 5518ac2a
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -4447,7 +4447,6 @@ ice_ena_vsi_rdma_qset(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
	struct ice_sched_node *parent;
	struct ice_hw *hw;
	u16 i, buf_size;
	int status;
	int ret;

	if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
@@ -4496,12 +4495,10 @@ ice_ena_vsi_rdma_qset(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
	node.data.elem_type = ICE_AQC_ELEM_TYPE_LEAF;
	for (i = 0; i < num_qsets; i++) {
		node.node_teid = buf->rdma_qsets[i].qset_teid;
		status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1,
		ret = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1,
					 &node);
		if (status) {
			ret = status;
		if (ret)
			break;
		}
		qset_teid[i] = le32_to_cpu(node.node_teid);
	}
rdma_error_exit:
+12 −13
Original line number Diff line number Diff line
@@ -251,7 +251,6 @@ static int ice_devlink_info_get(struct devlink *devlink,
	struct device *dev = ice_pf_to_dev(pf);
	struct ice_hw *hw = &pf->hw;
	struct ice_info_ctx *ctx;
	int status;
	size_t i;
	int err;

@@ -266,20 +265,20 @@ static int ice_devlink_info_get(struct devlink *devlink,
		return -ENOMEM;

	/* discover capabilities first */
	status = ice_discover_dev_caps(hw, &ctx->dev_caps);
	if (status) {
	err = ice_discover_dev_caps(hw, &ctx->dev_caps);
	if (err) {
		dev_dbg(dev, "Failed to discover device capabilities, status %d aq_err %s\n",
			status, ice_aq_str(hw->adminq.sq_last_status));
			err, ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Unable to discover device capabilities");
		err = -EIO;
		goto out_free_ctx;
	}

	if (ctx->dev_caps.common_cap.nvm_update_pending_orom) {
		status = ice_get_inactive_orom_ver(hw, &ctx->pending_orom);
		if (status) {
		err = ice_get_inactive_orom_ver(hw, &ctx->pending_orom);
		if (err) {
			dev_dbg(dev, "Unable to read inactive Option ROM version data, status %d aq_err %s\n",
				status, ice_aq_str(hw->adminq.sq_last_status));
				err, ice_aq_str(hw->adminq.sq_last_status));

			/* disable display of pending Option ROM */
			ctx->dev_caps.common_cap.nvm_update_pending_orom = false;
@@ -287,10 +286,10 @@ static int ice_devlink_info_get(struct devlink *devlink,
	}

	if (ctx->dev_caps.common_cap.nvm_update_pending_nvm) {
		status = ice_get_inactive_nvm_ver(hw, &ctx->pending_nvm);
		if (status) {
		err = ice_get_inactive_nvm_ver(hw, &ctx->pending_nvm);
		if (err) {
			dev_dbg(dev, "Unable to read inactive NVM version data, status %d aq_err %s\n",
				status, ice_aq_str(hw->adminq.sq_last_status));
				err, ice_aq_str(hw->adminq.sq_last_status));

			/* disable display of pending Option ROM */
			ctx->dev_caps.common_cap.nvm_update_pending_nvm = false;
@@ -298,10 +297,10 @@ static int ice_devlink_info_get(struct devlink *devlink,
	}

	if (ctx->dev_caps.common_cap.nvm_update_pending_netlist) {
		status = ice_get_inactive_netlist_ver(hw, &ctx->pending_netlist);
		if (status) {
		err = ice_get_inactive_netlist_ver(hw, &ctx->pending_netlist);
		if (err) {
			dev_dbg(dev, "Unable to read inactive Netlist version data, status %d aq_err %s\n",
				status, ice_aq_str(hw->adminq.sq_last_status));
				err, ice_aq_str(hw->adminq.sq_last_status));

			/* disable display of pending Option ROM */
			ctx->dev_caps.common_cap.nvm_update_pending_netlist = false;
+37 −42
Original line number Diff line number Diff line
@@ -271,8 +271,7 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
	struct ice_pf *pf = vsi->back;
	struct ice_hw *hw = &pf->hw;
	struct device *dev;
	int ret = 0;
	int status;
	int ret;
	u8 *buf;

	dev = ice_pf_to_dev(pf);
@@ -285,19 +284,19 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
	if (!buf)
		return -ENOMEM;

	status = ice_acquire_nvm(hw, ICE_RES_READ);
	if (status) {
	ret = ice_acquire_nvm(hw, ICE_RES_READ);
	if (ret) {
		dev_err(dev, "ice_acquire_nvm failed, err %d aq_err %s\n",
			status, ice_aq_str(hw->adminq.sq_last_status));
			ret, ice_aq_str(hw->adminq.sq_last_status));
		ret = -EIO;
		goto out;
	}

	status = ice_read_flat_nvm(hw, eeprom->offset, &eeprom->len, buf,
	ret = ice_read_flat_nvm(hw, eeprom->offset, &eeprom->len, buf,
				false);
	if (status) {
	if (ret) {
		dev_err(dev, "ice_read_flat_nvm failed, err %d aq_err %s\n",
			status, ice_aq_str(hw->adminq.sq_last_status));
			ret, ice_aq_str(hw->adminq.sq_last_status));
		ret = -EIO;
		goto release;
	}
@@ -1050,8 +1049,7 @@ ice_get_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam)
	struct ice_link_status *link_info;
	struct ice_vsi *vsi = np->vsi;
	struct ice_port_info *pi;
	int err = 0;
	int status;
	int err;

	pi = vsi->port_info;

@@ -1077,9 +1075,9 @@ ice_get_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam)
	if (!caps)
		return -ENOMEM;

	status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
	err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
				  caps, NULL);
	if (status) {
	if (err) {
		err = -EAGAIN;
		goto done;
	}
@@ -1936,8 +1934,7 @@ ice_get_link_ksettings(struct net_device *netdev,
	struct ice_aqc_get_phy_caps_data *caps;
	struct ice_link_status *hw_link_info;
	struct ice_vsi *vsi = np->vsi;
	int err = 0;
	int status;
	int err;

	ethtool_link_ksettings_zero_link_mode(ks, supported);
	ethtool_link_ksettings_zero_link_mode(ks, advertising);
@@ -1988,9 +1985,9 @@ ice_get_link_ksettings(struct net_device *netdev,
	if (!caps)
		return -ENOMEM;

	status = ice_aq_get_phy_caps(vsi->port_info, false,
	err = ice_aq_get_phy_caps(vsi->port_info, false,
				  ICE_AQC_REPORT_ACTIVE_CFG, caps, NULL);
	if (status) {
	if (err) {
		err = -EIO;
		goto done;
	}
@@ -2025,9 +2022,9 @@ ice_get_link_ksettings(struct net_device *netdev,
	    caps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_544_REQ)
		ethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS);

	status = ice_aq_get_phy_caps(vsi->port_info, false,
	err = ice_aq_get_phy_caps(vsi->port_info, false,
				  ICE_AQC_REPORT_TOPO_CAP_MEDIA, caps, NULL);
	if (status) {
	if (err) {
		err = -EIO;
		goto done;
	}
@@ -2210,9 +2207,8 @@ ice_set_link_ksettings(struct net_device *netdev,
	u8 autoneg_changed = 0;
	u64 phy_type_high = 0;
	u64 phy_type_low = 0;
	int err = 0;
	bool linkup;
	int status;
	int err;

	pi = np->vsi->port_info;

@@ -2232,12 +2228,12 @@ ice_set_link_ksettings(struct net_device *netdev,

	/* Get the PHY capabilities based on media */
	if (ice_fw_supports_report_dflt_cfg(pi->hw))
		status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_DFLT_CFG,
		err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_DFLT_CFG,
					  phy_caps, NULL);
	else
		status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
		err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
					  phy_caps, NULL);
	if (status) {
	if (err) {
		err = -EIO;
		goto done;
	}
@@ -2306,8 +2302,8 @@ ice_set_link_ksettings(struct net_device *netdev,

	/* Call to get the current link speed */
	pi->phy.get_link_info = true;
	status = ice_get_link_status(pi, &linkup);
	if (status) {
	err = ice_get_link_status(pi, &linkup);
	if (err) {
		err = -EIO;
		goto done;
	}
@@ -2379,8 +2375,8 @@ ice_set_link_ksettings(struct net_device *netdev,
	}

	/* make the aq call */
	status = ice_aq_set_phy_cfg(&pf->hw, pi, &config, NULL);
	if (status) {
	err = ice_aq_set_phy_cfg(&pf->hw, pi, &config, NULL);
	if (err) {
		netdev_info(netdev, "Set phy config failed,\n");
		err = -EIO;
		goto done;
@@ -3003,9 +2999,8 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
	struct ice_port_info *pi;
	u8 aq_failures;
	bool link_up;
	int err = 0;
	int status;
	u32 is_an;
	int err;

	pi = vsi->port_info;
	hw_link_info = &pi->phy.link_info;
@@ -3031,9 +3026,9 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
		return -ENOMEM;

	/* Get current PHY config */
	status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_ACTIVE_CFG, pcaps,
	err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_ACTIVE_CFG, pcaps,
				  NULL);
	if (status) {
	if (err) {
		kfree(pcaps);
		return -EIO;
	}
@@ -3071,19 +3066,19 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
		return -EINVAL;

	/* Set the FC mode and only restart AN if link is up */
	status = ice_set_fc(pi, &aq_failures, link_up);
	err = ice_set_fc(pi, &aq_failures, link_up);

	if (aq_failures & ICE_SET_FC_AQ_FAIL_GET) {
		netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %d aq_err %s\n",
			    status, ice_aq_str(hw->adminq.sq_last_status));
			    err, ice_aq_str(hw->adminq.sq_last_status));
		err = -EAGAIN;
	} else if (aq_failures & ICE_SET_FC_AQ_FAIL_SET) {
		netdev_info(netdev, "Set fc failed on the set_phy_config call with err %d aq_err %s\n",
			    status, ice_aq_str(hw->adminq.sq_last_status));
			    err, ice_aq_str(hw->adminq.sq_last_status));
		err = -EAGAIN;
	} else if (aq_failures & ICE_SET_FC_AQ_FAIL_UPDATE) {
		netdev_info(netdev, "Set fc failed on the get_link_info call with err %d aq_err %s\n",
			    status, ice_aq_str(hw->adminq.sq_last_status));
			    err, ice_aq_str(hw->adminq.sq_last_status));
		err = -EAGAIN;
	}

+17 −27
Original line number Diff line number Diff line
@@ -533,7 +533,6 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
	u64 entry1_h = 0;
	u64 entry2_h = 0;
	u64 prof_id;
	int status;
	int err;

	main_vsi = ice_get_main_vsi(pf);
@@ -581,24 +580,20 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
	 * actions (NULL) and zero actions 0.
	 */
	prof_id = flow + tun * ICE_FLTR_PTYPE_MAX;
	status = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id, seg,
	err = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id, seg,
				TNL_SEG_CNT(tun), &prof);
	if (status)
		return status;
	status = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
	if (err)
		return err;
	err = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
				 main_vsi->idx, ICE_FLOW_PRIO_NORMAL,
				 seg, &entry1_h);
	if (status) {
		err = status;
	if (err)
		goto err_prof;
	}
	status = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
	err = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
				 ctrl_vsi->idx, ICE_FLOW_PRIO_NORMAL,
				 seg, &entry2_h);
	if (status) {
		err = status;
	if (err)
		goto err_entry;
	}

	hw_prof->fdir_seg[tun] = seg;
	hw_prof->entry_h[0][tun] = entry1_h;
@@ -1192,7 +1187,6 @@ ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
	struct ice_vsi *ctrl_vsi;
	u8 *pkt, *frag_pkt;
	bool has_frag;
	int status;
	int err;

	ctrl_vsi = ice_get_ctrl_vsi(pf);
@@ -1209,11 +1203,9 @@ ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
	}

	ice_fdir_get_prgm_desc(hw, input, &desc, add);
	status = ice_fdir_get_gen_prgm_pkt(hw, input, pkt, false, is_tun);
	if (status) {
		err = status;
	err = ice_fdir_get_gen_prgm_pkt(hw, input, pkt, false, is_tun);
	if (err)
		goto err_free_all;
	}
	err = ice_prgm_fdir_fltr(ctrl_vsi, &desc, pkt);
	if (err)
		goto err_free_all;
@@ -1223,12 +1215,10 @@ ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
	if (has_frag) {
		/* does not return error */
		ice_fdir_get_prgm_desc(hw, input, &desc, add);
		status = ice_fdir_get_gen_prgm_pkt(hw, input, frag_pkt, true,
		err = ice_fdir_get_gen_prgm_pkt(hw, input, frag_pkt, true,
						is_tun);
		if (status) {
			err = status;
		if (err)
			goto err_frag;
		}
		err = ice_prgm_fdir_fltr(ctrl_vsi, &desc, frag_pkt);
		if (err)
			goto err_frag;
+18 −24
Original line number Diff line number Diff line
@@ -276,7 +276,6 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
	struct ice_rq_event_info event;
	struct ice_hw *hw = &pf->hw;
	u32 completion_offset;
	int status;
	int err;

	memset(&event, 0, sizeof(event));
@@ -284,11 +283,11 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
	dev_dbg(dev, "Writing block of %u bytes for module 0x%02x at offset %u\n",
		block_size, module, offset);

	status = ice_aq_update_nvm(hw, module, offset, block_size, block,
	err = ice_aq_update_nvm(hw, module, offset, block_size, block,
				last_cmd, 0, NULL);
	if (status) {
	if (err) {
		dev_err(dev, "Failed to flash module 0x%02x with block of size %u at offset %u, err %d aq_err %s\n",
			module, block_size, offset, status,
			module, block_size, offset, err,
			ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Failed to program flash module");
		return -EIO;
@@ -443,7 +442,6 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
	struct ice_rq_event_info event;
	struct ice_hw *hw = &pf->hw;
	struct devlink *devlink;
	int status;
	int err;

	dev_dbg(dev, "Beginning erase of flash component '%s', module 0x%02x\n", component, module);
@@ -454,10 +452,10 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,

	devlink_flash_update_timeout_notify(devlink, "Erasing", component, ICE_FW_ERASE_TIMEOUT);

	status = ice_aq_erase_nvm(hw, module, NULL);
	if (status) {
	err = ice_aq_erase_nvm(hw, module, NULL);
	if (err) {
		dev_err(dev, "Failed to erase %s (module 0x%02x), err %d aq_err %s\n",
			component, module, status,
			component, module, err,
			ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Failed to erase flash module");
		err = -EIO;
@@ -523,15 +521,14 @@ static int ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags,
	struct ice_rq_event_info event;
	struct ice_hw *hw = &pf->hw;
	u16 completion_retval;
	int status;
	int err;

	memset(&event, 0, sizeof(event));

	status = ice_nvm_write_activate(hw, activate_flags);
	if (status) {
	err = ice_nvm_write_activate(hw, activate_flags);
	if (err) {
		dev_err(dev, "Failed to switch active flash banks, err %d aq_err %s\n",
			status, ice_aq_str(hw->adminq.sq_last_status));
			err, ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Failed to switch active flash banks");
		return -EIO;
	}
@@ -667,7 +664,6 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw,
	struct device *dev = ice_pf_to_dev(pf);
	struct ice_hw *hw = &pf->hw;
	struct ice_fwu_priv priv;
	int status;
	int err;

	switch (preservation) {
@@ -689,10 +685,10 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw,
	priv.pf = pf;
	priv.activate_flags = preservation;

	status = ice_acquire_nvm(hw, ICE_RES_WRITE);
	if (status) {
	err = ice_acquire_nvm(hw, ICE_RES_WRITE);
	if (err) {
		dev_err(dev, "Failed to acquire device flash lock, err %d aq_err %s\n",
			status, ice_aq_str(hw->adminq.sq_last_status));
			err, ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Failed to acquire device flash lock");
		return -EIO;
	}
@@ -733,7 +729,6 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
	struct ice_hw_dev_caps *dev_caps;
	struct ice_hw *hw = &pf->hw;
	u8 pending = 0;
	int status;
	int err;

	dev_caps = kzalloc(sizeof(*dev_caps), GFP_KERNEL);
@@ -745,8 +740,8 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
	 * may have changed, e.g. if an update was previously completed and
	 * the system has not yet rebooted.
	 */
	status = ice_discover_dev_caps(hw, dev_caps);
	if (status) {
	err = ice_discover_dev_caps(hw, dev_caps);
	if (err) {
		NL_SET_ERR_MSG_MOD(extack, "Unable to read device capabilities");
		kfree(dev_caps);
		return -EIO;
@@ -794,11 +789,10 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
					   "Canceling previous pending update",
					   component, 0, 0);

	status = ice_acquire_nvm(hw, ICE_RES_WRITE);
	if (status) {
	err = ice_acquire_nvm(hw, ICE_RES_WRITE);
	if (err) {
		dev_err(dev, "Failed to acquire device flash lock, err %d aq_err %s\n",
			status,
			ice_aq_str(hw->adminq.sq_last_status));
			err, ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Failed to acquire device flash lock");
		return -EIO;
	}
Loading