diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-07-17 12:30:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-24 15:05:24 -0400 |
commit | b23a0524a38b146f85be44ae0d71abd2a710f4ab (patch) | |
tree | ba0442f1689b6b39eed1b0d84b866a3a21adbb96 /drivers/net/wireless/iwlwifi/iwl-eeprom.c | |
parent | e5108d075c705ed3336163d9ead2b8fe629f680d (diff) |
iwlwifi: checking unknown HW type
When deciding NVM type, if the HW type is unknown, report error and exit
with -ENOENT. This check should prevent incorrect behavior by assuming
the wrong NVM type.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-eeprom.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-eeprom.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 7d7554a2f341..51eed7226669 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -159,6 +159,9 @@ static int iwlcore_get_nvm_type(struct iwl_priv *priv) | |||
159 | 159 | ||
160 | /* OTP only valid for CP/PP and after */ | 160 | /* OTP only valid for CP/PP and after */ |
161 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { | 161 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { |
162 | case CSR_HW_REV_TYPE_NONE: | ||
163 | IWL_ERR(priv, "Unknown hardware type\n"); | ||
164 | return -ENOENT; | ||
162 | case CSR_HW_REV_TYPE_3945: | 165 | case CSR_HW_REV_TYPE_3945: |
163 | case CSR_HW_REV_TYPE_4965: | 166 | case CSR_HW_REV_TYPE_4965: |
164 | case CSR_HW_REV_TYPE_5300: | 167 | case CSR_HW_REV_TYPE_5300: |
@@ -266,7 +269,8 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
266 | u32 otpgp; | 269 | u32 otpgp; |
267 | 270 | ||
268 | priv->nvm_device_type = iwlcore_get_nvm_type(priv); | 271 | priv->nvm_device_type = iwlcore_get_nvm_type(priv); |
269 | 272 | if (priv->nvm_device_type == -ENOENT) | |
273 | return -ENOENT; | ||
270 | /* allocate eeprom */ | 274 | /* allocate eeprom */ |
271 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) | 275 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) |
272 | priv->cfg->eeprom_size = | 276 | priv->cfg->eeprom_size = |