mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
wifi: iwlwifi: return ERR_PTR from opmode start()
In order to restrict the retry loops for timeouts, first pass the error code up using ERR_PTR(). This of course requires all existing functions to be updated accordingly. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20241227095718.3fe5031d5784.I7307996c91dac69619ff9c616b8a077423fac19f@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
@@ -1241,7 +1241,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
|
||||
STATISTICS_NOTIFICATION,
|
||||
REPLY_TX,
|
||||
};
|
||||
int i;
|
||||
int i, err;
|
||||
|
||||
/************************
|
||||
* 1. Allocating HW data
|
||||
@@ -1249,6 +1249,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
|
||||
hw = iwl_alloc_all();
|
||||
if (!hw) {
|
||||
pr_err("%s: Cannot allocate network device\n", trans->name);
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1299,8 +1300,10 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
|
||||
break;
|
||||
}
|
||||
|
||||
if (WARN_ON(!priv->lib))
|
||||
if (WARN_ON(!priv->lib)) {
|
||||
err = -ENODEV;
|
||||
goto out_free_hw;
|
||||
}
|
||||
|
||||
/*
|
||||
* Populate the state variables that the transport layer needs
|
||||
@@ -1377,12 +1380,14 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
|
||||
IWL_INFO(priv, "Detected %s, REV=0x%X\n",
|
||||
priv->trans->name, priv->trans->hw_rev);
|
||||
|
||||
if (iwl_trans_start_hw(priv->trans))
|
||||
err = iwl_trans_start_hw(priv->trans);
|
||||
if (err)
|
||||
goto out_free_hw;
|
||||
|
||||
/* Read the EEPROM */
|
||||
if (iwl_read_eeprom(priv->trans, &priv->eeprom_blob,
|
||||
&priv->eeprom_blob_size)) {
|
||||
err = iwl_read_eeprom(priv->trans, &priv->eeprom_blob,
|
||||
&priv->eeprom_blob_size);
|
||||
if (err) {
|
||||
IWL_ERR(priv, "Unable to init EEPROM\n");
|
||||
goto out_free_hw;
|
||||
}
|
||||
@@ -1393,13 +1398,17 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
|
||||
priv->nvm_data = iwl_parse_eeprom_data(priv->trans, priv->cfg,
|
||||
priv->eeprom_blob,
|
||||
priv->eeprom_blob_size);
|
||||
if (!priv->nvm_data)
|
||||
if (!priv->nvm_data) {
|
||||
err = -ENOMEM;
|
||||
goto out_free_eeprom_blob;
|
||||
}
|
||||
|
||||
if (iwl_nvm_check_version(priv->nvm_data, priv->trans))
|
||||
err = iwl_nvm_check_version(priv->nvm_data, priv->trans);
|
||||
if (err)
|
||||
goto out_free_eeprom;
|
||||
|
||||
if (iwl_eeprom_init_hw_params(priv))
|
||||
err = iwl_eeprom_init_hw_params(priv);
|
||||
if (err)
|
||||
goto out_free_eeprom;
|
||||
|
||||
/* extract MAC Address */
|
||||
@@ -1446,7 +1455,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
|
||||
atomic_set(&priv->queue_stop_count[i], 0);
|
||||
}
|
||||
|
||||
if (iwl_init_drv(priv))
|
||||
err = iwl_init_drv(priv);
|
||||
if (err)
|
||||
goto out_free_eeprom;
|
||||
|
||||
/* At this point both hw and priv are initialized. */
|
||||
@@ -1480,7 +1490,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
|
||||
*
|
||||
* 7. Setup and register with mac80211 and debugfs
|
||||
**************************************************/
|
||||
if (iwlagn_mac_setup_register(priv, &fw->ucode_capa))
|
||||
err = iwlagn_mac_setup_register(priv, &fw->ucode_capa);
|
||||
if (err)
|
||||
goto out_destroy_workqueue;
|
||||
|
||||
iwl_dbgfs_register(priv, dbgfs_dir);
|
||||
@@ -1500,8 +1511,7 @@ out_free_eeprom:
|
||||
out_free_hw:
|
||||
ieee80211_free_hw(priv->hw);
|
||||
out:
|
||||
op_mode = NULL;
|
||||
return op_mode;
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
|
||||
|
||||
@@ -1429,7 +1429,7 @@ _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op)
|
||||
op_mode = ops->start(drv->trans, drv->trans->cfg,
|
||||
&drv->fw, dbgfs_dir);
|
||||
|
||||
if (op_mode)
|
||||
if (!IS_ERR(op_mode))
|
||||
return op_mode;
|
||||
|
||||
if (test_bit(STATUS_TRANS_DEAD, &drv->trans->status))
|
||||
|
||||
@@ -1285,6 +1285,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
size_t scan_size;
|
||||
u32 min_backoff;
|
||||
struct iwl_mvm_csme_conn_info *csme_conn_info __maybe_unused;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* We use IWL_STATION_COUNT_MAX to check the validity of the station
|
||||
@@ -1302,7 +1303,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
iwl_mvm_has_mld_api(fw) ? &iwl_mvm_mld_hw_ops :
|
||||
&iwl_mvm_hw_ops);
|
||||
if (!hw)
|
||||
return NULL;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
|
||||
max_agg = 512;
|
||||
@@ -1347,8 +1348,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
trans->rx_mpdu_cmd_hdr_size =
|
||||
sizeof(struct iwl_rx_mpdu_res_start);
|
||||
|
||||
if (WARN_ON(trans->num_rx_queues > 1))
|
||||
if (WARN_ON(trans->num_rx_queues > 1)) {
|
||||
err = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
|
||||
mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0;
|
||||
@@ -1425,8 +1428,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
iwl_fw_lookup_notif_ver(mvm->fw, LOCATION_GROUP,
|
||||
TOF_RANGE_RESPONSE_NOTIF, 5);
|
||||
/* we only support up to version 9 */
|
||||
if (WARN_ON_ONCE(mvm->cmd_ver.range_resp > 9))
|
||||
if (WARN_ON_ONCE(mvm->cmd_ver.range_resp > 9)) {
|
||||
err = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/*
|
||||
* Populate the state variables that the transport layer needs
|
||||
@@ -1489,6 +1494,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
mvm->phy_db = iwl_phy_db_init(trans);
|
||||
if (!mvm->phy_db) {
|
||||
IWL_ERR(mvm, "Cannot init phy_db\n");
|
||||
err = -ENOMEM;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
@@ -1501,8 +1507,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
scan_size = iwl_mvm_scan_size(mvm);
|
||||
|
||||
mvm->scan_cmd = kmalloc(scan_size, GFP_KERNEL);
|
||||
if (!mvm->scan_cmd)
|
||||
if (!mvm->scan_cmd) {
|
||||
err = -ENOMEM;
|
||||
goto out_free;
|
||||
}
|
||||
mvm->scan_cmd_size = scan_size;
|
||||
|
||||
/* invalidate ids to prevent accidental removal of sta_id 0 */
|
||||
@@ -1531,7 +1539,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
|
||||
iwl_mvm_mei_scan_filter_init(&mvm->mei_scan_filter);
|
||||
|
||||
if (iwl_mvm_start_get_nvm(mvm)) {
|
||||
err = iwl_mvm_start_get_nvm(mvm);
|
||||
if (err) {
|
||||
/*
|
||||
* Getting NVM failed while CSME is the owner, but we are
|
||||
* registered to MEI, we'll get the NVM later when it'll be
|
||||
@@ -1544,7 +1553,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
}
|
||||
|
||||
|
||||
if (iwl_mvm_start_post_nvm(mvm))
|
||||
err = iwl_mvm_start_post_nvm(mvm);
|
||||
if (err)
|
||||
goto out_thermal_exit;
|
||||
|
||||
return op_mode;
|
||||
@@ -1564,7 +1574,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
iwl_trans_op_mode_leave(trans);
|
||||
|
||||
ieee80211_free_hw(mvm->hw);
|
||||
return NULL;
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
void iwl_mvm_stop_device(struct iwl_mvm *mvm)
|
||||
|
||||
Reference in New Issue
Block a user