Commit c281f137 authored by Johannes Berg's avatar Johannes Berg Committed by Luca Coelho

iwlwifi: mvm: make NVM access actually fail on failures

On any failure, including if we crash the firmware or get garbage
data, we currently ignore this and pretend the OTP was empty.
Clearly, this isn't typically the case.

In cases other than the firmware saying it can't read the requested
section, or the section having ended, make the access actually fail
and trickle the error up through the layers to fail init.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 7e08baeb
...@@ -179,7 +179,7 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section, ...@@ -179,7 +179,7 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,
IWL_DEBUG_EEPROM(mvm->trans->dev, IWL_DEBUG_EEPROM(mvm->trans->dev,
"NVM access command failed with status %d (device: %s)\n", "NVM access command failed with status %d (device: %s)\n",
ret, mvm->cfg->name); ret, mvm->cfg->name);
ret = -EIO; ret = -ENODATA;
} }
goto exit; goto exit;
} }
...@@ -380,8 +380,12 @@ int iwl_nvm_init(struct iwl_mvm *mvm) ...@@ -380,8 +380,12 @@ int iwl_nvm_init(struct iwl_mvm *mvm)
/* we override the constness for initial read */ /* we override the constness for initial read */
ret = iwl_nvm_read_section(mvm, section, nvm_buffer, ret = iwl_nvm_read_section(mvm, section, nvm_buffer,
size_read); size_read);
if (ret < 0) if (ret == -ENODATA) {
ret = 0;
continue; continue;
}
if (ret < 0)
break;
size_read += ret; size_read += ret;
temp = kmemdup(nvm_buffer, ret, GFP_KERNEL); temp = kmemdup(nvm_buffer, ret, GFP_KERNEL);
if (!temp) { if (!temp) {
...@@ -454,7 +458,7 @@ int iwl_nvm_init(struct iwl_mvm *mvm) ...@@ -454,7 +458,7 @@ int iwl_nvm_init(struct iwl_mvm *mvm)
IWL_DEBUG_EEPROM(mvm->trans->dev, "nvm version = %x\n", IWL_DEBUG_EEPROM(mvm->trans->dev, "nvm version = %x\n",
mvm->nvm_data->nvm_version); mvm->nvm_data->nvm_version);
return 0; return ret < 0 ? ret : 0;
} }
struct iwl_mcc_update_resp * struct iwl_mcc_update_resp *
......
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