From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: <linville@tuxdriver.com>
Cc: <linux-wireless@vger.kernel.org>, <ath9k-devel@lists.ath9k.org>,
"Luis R. Rodriguez" <lrodriguez@atheros.com>,
Vivek Natarajan <vnatarajan@atheros.com>
Subject: [PATCH] ath9k: fix compile warning on ath9k_hw_AR9287_check_eeprom()
Date: Mon, 3 Aug 2009 13:51:49 -0700 [thread overview]
Message-ID: <1249332709-27374-1-git-send-email-lrodriguez@atheros.com> (raw)
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>
---
drivers/net/wireless/ath/ath9k/eeprom.c | 13 +++++++++----
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 e8ccec0..4e4a300 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -2816,7 +2816,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_t) / sizeof(u16))
u32 sum = 0, el, integer;
u16 temp, word, magic, magic2, *eepdata;
int i, addr;
@@ -2842,7 +2841,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_t) / sizeof(u16);
+ addr++) {
temp = swab16(*eepdata);
*eepdata = temp;
eepdata++;
@@ -2862,8 +2863,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_t))
+ el = sizeof(struct ar9287_eeprom_t) / 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) {
@@ -2914,7 +2920,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,
--
1.6.3.3
reply other threads:[~2009-08-03 20:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1249332709-27374-1-git-send-email-lrodriguez@atheros.com \
--to=lrodriguez@atheros.com \
--cc=ath9k-devel@lists.ath9k.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=vnatarajan@atheros.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).