Search Linux Wireless

[PATCH]: ath9k: fix bug in tx power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ath9k driver subtracts 3 dBm to the txpower as with two radios the
signal power is doubled.
The resulting value is assigned in an u16 which overflows and makes
the card to work at full power.

Signed-off-by: Matteo Croce <matteo@xxxxxxxxxxx>

--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c	2010-12-02
22:39:58.982020001 +0100
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c	2010-12-02
23:05:43.662020001 +0100
@@ -1065,15 +1065,19 @@
 	case 1:
 		break;
 	case 2:
-		scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
+		if(scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
+			scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
+		else
+			scaledPower = 0;
 		break;
 	case 3:
-		scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
+		if(scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
+			scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
+		else
+			scaledPower = 0;
 		break;
 	}

-	scaledPower = max((u16)0, scaledPower);
-
 	if (IS_CHAN_2GHZ(chan)) {
 		numCtlModes = ARRAY_SIZE(ctlModesFor11g) -
 			SUB_NUM_CTL_MODES_AT_2G_40;


-- 
Matteo Croce
OpenWrt developer
 _______         Â ________    __
Â|Â Â ÂÂ |.-----.-----.-----.|Â |Â |Â |.----.|Â |_
Â|ÂÂ -ÂÂ ||Â _Â |Â -__|Â ÂÂ ||Â |Â |Â ||ÂÂ _||ÂÂ _|
Â|_______||ÂÂ __|_____|__|__||________||__|Â |____|
     |__| W I R E L E S S F R E E D O M
ÂKAMIKAZE (bleeding edge) ------------------
 * 10 oz Vodka  Â Shake well with ice and strain
 * 10 oz Triple sec mixture into 10 shot glasses.
 * 10 oz lime juice Salute!
Â---------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux