+@@ -2145,7 +2145,16 @@ static void ath9k_hw_ar9300_set_txpower(
+ twiceMaxRegulatoryPower,
+ powerLimit);
+
+- while (i < ar9300RateSize) {
++ regulatory->max_power_level = 0;
++ for (i = 0; i < ar9300RateSize; i++) {
++ if (targetPowerValT2[i] > regulatory->max_power_level)
++ regulatory->max_power_level = targetPowerValT2[i];
++ }
++
++ if (test)
++ return;
++
++ for (i = 0; i < ar9300RateSize; i++) {
+ ath_print(common, ATH_DBG_EEPROM,
+ "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
+ i++;
+@@ -2160,9 +2169,6 @@ static void ath9k_hw_ar9300_set_txpower(