summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-08-03 13:51:49 -0700
committerJohn W. Linville <linville@tuxdriver.com>2009-08-04 16:44:35 -0400
commit6b4f645a491ac29c7dced415d034eea7736155a6 (patch)
tree23ebc02a51d10feade41262e04b46ca7a1642b10
parente3b90ca28412fb9dcc8c5ca38e179e78fec07eee (diff)
ath9k: fix compile warning on ath9k_hw_AR9287_check_eeprom()
CC [M] drivers/net/wireless/ath/ath9k/eeprom.o drivers/net/wireless/ath/ath9k/eeprom.c: In function ‘ath9k_hw_AR9287_check_eeprom’: drivers/net/wireless/ath/ath9k/eeprom.c:2866: warning: comparison of distinct pointer types lacks a cast Cc: Vivek Natarajan <vnatarajan@atheros.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 9a09cc8e7044..4cb64a0900bb 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -2892,7 +2892,6 @@ static bool ath9k_hw_AR9287_fill_eeprom(struct ath_hw *ah)
}
static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
{
-#define SIZE_EEPROM_87 (sizeof(struct ar9287_eeprom) / sizeof(u16))
u32 sum = 0, el, integer;
u16 temp, word, magic, magic2, *eepdata;
int i, addr;
@@ -2918,7 +2917,9 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
need_swap = true;
eepdata = (u16 *)(&ah->eeprom);
- for (addr = 0; addr < SIZE_EEPROM_87; addr++) {
+ for (addr = 0;
+ addr < sizeof(struct ar9287_eeprom) / sizeof(u16);
+ addr++) {
temp = swab16(*eepdata);
*eepdata = temp;
eepdata++;
@@ -2938,8 +2939,13 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
else
el = ah->eeprom.map9287.baseEepHeader.length;
+ if (el > sizeof(struct ar9287_eeprom))
+ el = sizeof(struct ar9287_eeprom) / sizeof(u16);
+ else
+ el = el / sizeof(u16);
+
eepdata = (u16 *)(&ah->eeprom);
- for (i = 0; i < min(el, SIZE_EEPROM_87); i++)
+ for (i = 0; i < el; i++)
sum ^= *eepdata++;
if (need_swap) {
@@ -2990,7 +2996,6 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
}
return 0;
-#undef SIZE_EEPROM_87
}
static u32 ath9k_hw_AR9287_get_eeprom(struct ath_hw *ah,