aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
diff options
context:
space:
mode:
authorEran Harary <eran.harary@intel.com>2014-05-07 04:09:11 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-06-24 14:55:31 -0400
commit6a68a39fcd3af3f8ae3d185a8a2c8a82cf0363ef (patch)
treef1a11cb1e1c2aa6cc1e679f8a6b6fd6123ea7f9b /drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
parentc9e38e770981ff25d203f0f5c1423a863c484446 (diff)
iwlwifi: mvm: fix bug in set_hw_address function
Don't use nvm_hw pointer if it is NULL. Print an error message if the MAC address isn't valid. Signed-off-by: Eran Harary <eran.harary@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-nvm-parse.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-nvm-parse.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
index 0e3322a136c5..f0ae038f3339 100644
--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -476,7 +476,8 @@ static void iwl_set_hw_address(const struct iwl_cfg *cfg,
476 data->hw_addr[5] = hw_addr[4]; 476 data->hw_addr[5] = hw_addr[4];
477} 477}
478 478
479static void iwl_set_hw_address_family_8000(const struct iwl_cfg *cfg, 479static void iwl_set_hw_address_family_8000(struct device *dev,
480 const struct iwl_cfg *cfg,
480 struct iwl_nvm_data *data, 481 struct iwl_nvm_data *data,
481 const __le16 *mac_override, 482 const __le16 *mac_override,
482 const __le16 *nvm_hw) 483 const __le16 *nvm_hw)
@@ -495,20 +496,28 @@ static void iwl_set_hw_address_family_8000(const struct iwl_cfg *cfg,
495 data->hw_addr[4] = hw_addr[5]; 496 data->hw_addr[4] = hw_addr[5];
496 data->hw_addr[5] = hw_addr[4]; 497 data->hw_addr[5] = hw_addr[4];
497 498
498 if (is_valid_ether_addr(hw_addr)) 499 if (is_valid_ether_addr(data->hw_addr))
499 return; 500 return;
501
502 IWL_ERR_DEV(dev,
503 "mac address from nvm override section is not valid\n");
500 } 504 }
501 505
502 /* take the MAC address from the OTP */ 506 if (nvm_hw) {
503 hw_addr = (const u8 *)(nvm_hw + HW_ADDR0_FAMILY_8000); 507 /* take the MAC address from the OTP */
504 data->hw_addr[0] = hw_addr[3]; 508 hw_addr = (const u8 *)(nvm_hw + HW_ADDR0_FAMILY_8000);
505 data->hw_addr[1] = hw_addr[2]; 509 data->hw_addr[0] = hw_addr[3];
506 data->hw_addr[2] = hw_addr[1]; 510 data->hw_addr[1] = hw_addr[2];
507 data->hw_addr[3] = hw_addr[0]; 511 data->hw_addr[2] = hw_addr[1];
512 data->hw_addr[3] = hw_addr[0];
513
514 hw_addr = (const u8 *)(nvm_hw + HW_ADDR1_FAMILY_8000);
515 data->hw_addr[4] = hw_addr[1];
516 data->hw_addr[5] = hw_addr[0];
517 return;
518 }
508 519
509 hw_addr = (const u8 *)(nvm_hw + HW_ADDR1_FAMILY_8000); 520 IWL_ERR_DEV(dev, "mac address is not found\n");
510 data->hw_addr[4] = hw_addr[1];
511 data->hw_addr[5] = hw_addr[0];
512} 521}
513 522
514struct iwl_nvm_data * 523struct iwl_nvm_data *
@@ -570,7 +579,8 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
570 rx_chains); 579 rx_chains);
571 } else { 580 } else {
572 /* MAC address in family 8000 */ 581 /* MAC address in family 8000 */
573 iwl_set_hw_address_family_8000(cfg, data, mac_override, nvm_hw); 582 iwl_set_hw_address_family_8000(dev, cfg, data, mac_override,
583 nvm_hw);
574 584
575 iwl_init_sbands(dev, cfg, data, regulatory, 585 iwl_init_sbands(dev, cfg, data, regulatory,
576 sku & NVM_SKU_CAP_11AC_ENABLE, tx_chains, 586 sku & NVM_SKU_CAP_11AC_ENABLE, tx_chains,