Commit 12de5de4 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Gregory Greenman

wifi: iwlwifi: improve tag handling in iwl_request_firmware

We can remove the intermediary string conversion and use drv->fw_index
in the final snprintf directly.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20230127002430.175bfffdf2f5.I7ec7a29b2d93a977cb0a39dbcc7c875032eb14b7@changeidSigned-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
parent 24091f87
...@@ -163,7 +163,6 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, ...@@ -163,7 +163,6 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw,
static int iwl_request_firmware(struct iwl_drv *drv, bool first) static int iwl_request_firmware(struct iwl_drv *drv, bool first)
{ {
const struct iwl_cfg *cfg = drv->trans->cfg; const struct iwl_cfg *cfg = drv->trans->cfg;
char tag[8];
if (drv->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_9000 && if (drv->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_9000 &&
(drv->trans->hw_rev_step != SILICON_B_STEP && (drv->trans->hw_rev_step != SILICON_B_STEP &&
...@@ -174,13 +173,10 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) ...@@ -174,13 +173,10 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
return -EINVAL; return -EINVAL;
} }
if (first) { if (first)
drv->fw_index = cfg->ucode_api_max; drv->fw_index = cfg->ucode_api_max;
sprintf(tag, "%d", drv->fw_index); else
} else {
drv->fw_index--; drv->fw_index--;
sprintf(tag, "%d", drv->fw_index);
}
if (drv->fw_index < cfg->ucode_api_min) { if (drv->fw_index < cfg->ucode_api_min) {
IWL_ERR(drv, "no suitable firmware found!\n"); IWL_ERR(drv, "no suitable firmware found!\n");
...@@ -200,8 +196,8 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) ...@@ -200,8 +196,8 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
return -ENOENT; return -ENOENT;
} }
snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode", snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%d.ucode",
cfg->fw_name_pre, tag); cfg->fw_name_pre, drv->fw_index);
IWL_DEBUG_FW_INFO(drv, "attempting to load firmware '%s'\n", IWL_DEBUG_FW_INFO(drv, "attempting to load firmware '%s'\n",
drv->firmware_name); drv->firmware_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment