diff options
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index aa1a77d4cd90..84a9aafd91a2 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -3516,6 +3516,7 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr, | |||
3516 | { | 3516 | { |
3517 | unsigned int i; | 3517 | unsigned int i; |
3518 | u16 *rates; | 3518 | u16 *rates; |
3519 | s16 rate_idx_scaled = 0; | ||
3519 | 3520 | ||
3520 | /* max_pwr is power level we got from driver/user in 0.5dB | 3521 | /* max_pwr is power level we got from driver/user in 0.5dB |
3521 | * units, switch to 0.25dB units so we can compare */ | 3522 | * units, switch to 0.25dB units so we can compare */ |
@@ -3580,10 +3581,13 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr, | |||
3580 | * match the power range set by user with the power indices | 3581 | * match the power range set by user with the power indices |
3581 | * on PCDAC/PDADC table */ | 3582 | * on PCDAC/PDADC table */ |
3582 | for (i = 0; i < 16; i++) { | 3583 | for (i = 0; i < 16; i++) { |
3583 | rates[i] += ah->ah_txpower.txp_offset; | 3584 | rate_idx_scaled = rates[i] + ah->ah_txpower.txp_offset; |
3584 | /* Don't get out of bounds */ | 3585 | /* Don't get out of bounds */ |
3585 | if (rates[i] > 63) | 3586 | if (rate_idx_scaled > 63) |
3586 | rates[i] = 63; | 3587 | rate_idx_scaled = 63; |
3588 | if (rate_idx_scaled < 0) | ||
3589 | rate_idx_scaled = 0; | ||
3590 | rates[i] = rate_idx_scaled; | ||
3587 | } | 3591 | } |
3588 | } | 3592 | } |
3589 | 3593 | ||