mirror of
https://github.com/torvalds/linux.git
synced 2024-12-18 09:02:17 +00:00
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>
This commit is contained in:
parent
e5108d075c
commit
b23a0524a3
@ -159,6 +159,9 @@ static int iwlcore_get_nvm_type(struct iwl_priv *priv)
|
|||||||
|
|
||||||
/* OTP only valid for CP/PP and after */
|
/* OTP only valid for CP/PP and after */
|
||||||
switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
|
switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
|
||||||
|
case CSR_HW_REV_TYPE_NONE:
|
||||||
|
IWL_ERR(priv, "Unknown hardware type\n");
|
||||||
|
return -ENOENT;
|
||||||
case CSR_HW_REV_TYPE_3945:
|
case CSR_HW_REV_TYPE_3945:
|
||||||
case CSR_HW_REV_TYPE_4965:
|
case CSR_HW_REV_TYPE_4965:
|
||||||
case CSR_HW_REV_TYPE_5300:
|
case CSR_HW_REV_TYPE_5300:
|
||||||
@ -266,7 +269,8 @@ int iwl_eeprom_init(struct iwl_priv *priv)
|
|||||||
u32 otpgp;
|
u32 otpgp;
|
||||||
|
|
||||||
priv->nvm_device_type = iwlcore_get_nvm_type(priv);
|
priv->nvm_device_type = iwlcore_get_nvm_type(priv);
|
||||||
|
if (priv->nvm_device_type == -ENOENT)
|
||||||
|
return -ENOENT;
|
||||||
/* allocate eeprom */
|
/* allocate eeprom */
|
||||||
if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
|
if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
|
||||||
priv->cfg->eeprom_size =
|
priv->cfg->eeprom_size =
|
||||||
|
Loading…
Reference in New Issue
Block a user