aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-11-13 14:56:23 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-18 17:09:02 -0500
commit85f0d9e87794818356146996826b829100daa6bc (patch)
tree6420ac21cd980e3685a6adfc2d77a2cd26c92ab0 /drivers
parentdfef948ed2ba69cf041840b5e860d6b4e16fa0b1 (diff)
iwlwifi: validate enhanced tx power entry
Validate enhanced tx power entry read from EEPROM before applying the tx power value. Different versions of EEPROM might contain different size of table; always a good idea to make sure the entry is valid before applying to the targeted channel. 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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h6
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 8a0709e81a9f..143728c6382e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -913,6 +913,16 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
913 enhanced_txpower = (struct iwl_eeprom_enhanced_txpwr *) 913 enhanced_txpower = (struct iwl_eeprom_enhanced_txpwr *)
914 iwl_eeprom_query_addr(priv, offset); 914 iwl_eeprom_query_addr(priv, offset);
915 915
916 /*
917 * check for valid entry -
918 * different version of EEPROM might contain different set
919 * of enhanced tx power table
920 * always check for valid entry before process
921 * the information
922 */
923 if (!enhanced_txpower->common || enhanced_txpower->reserved)
924 continue;
925
916 for (element = 0; element < eeprom_section_count; element++) { 926 for (element = 0; element < eeprom_section_count; element++) {
917 if (enhinfo[section].is_common) 927 if (enhinfo[section].is_common)
918 max_txpower_avg = 928 max_txpower_avg =
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 5ba5a4e9e49a..5cd2b66bbe45 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -127,19 +127,21 @@ struct iwl_eeprom_channel {
127 * Enhanced regulatory tx power portion of eeprom image can be broken down 127 * Enhanced regulatory tx power portion of eeprom image can be broken down
128 * into individual structures; each one is 8 bytes in size and contain the 128 * into individual structures; each one is 8 bytes in size and contain the
129 * following information 129 * following information
130 * @common: (desc + channel) not used by driver, should _NOT_ be "zero"
130 * @chain_a_max_pwr: chain a max power in 1/2 dBm 131 * @chain_a_max_pwr: chain a max power in 1/2 dBm
131 * @chain_b_max_pwr: chain b max power in 1/2 dBm 132 * @chain_b_max_pwr: chain b max power in 1/2 dBm
132 * @chain_c_max_pwr: chain c max power in 1/2 dBm 133 * @chain_c_max_pwr: chain c max power in 1/2 dBm
134 * @reserved: not used, should be "zero"
133 * @mimo2_max_pwr: mimo2 max power in 1/2 dBm 135 * @mimo2_max_pwr: mimo2 max power in 1/2 dBm
134 * @mimo3_max_pwr: mimo3 max power in 1/2 dBm 136 * @mimo3_max_pwr: mimo3 max power in 1/2 dBm
135 * 137 *
136 */ 138 */
137struct iwl_eeprom_enhanced_txpwr { 139struct iwl_eeprom_enhanced_txpwr {
138 u16 reserved; 140 u16 common;
139 s8 chain_a_max; 141 s8 chain_a_max;
140 s8 chain_b_max; 142 s8 chain_b_max;
141 s8 chain_c_max; 143 s8 chain_c_max;
142 s8 reserved1; 144 s8 reserved;
143 s8 mimo2_max; 145 s8 mimo2_max;
144 s8 mimo3_max; 146 s8 mimo3_max;
145} __attribute__ ((packed)); 147} __attribute__ ((packed));