linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.32-rc2] ar9170: fix bug in iq-auto calibration value calculation
@ 2009-09-29 18:47 Christian Lamparter
  0 siblings, 0 replies; only message in thread
From: Christian Lamparter @ 2009-09-29 18:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, Andrew Morton, Joerg Albert, David S. Miller

This patch fixes a embarrassing bug which was introduced by:
"[PATCH] ar9170: implement frequency calibration for one-stage/openfw"

The phy_data variable initialization has to done outside the for-loop
scope. This is because the for-loop uses u32 phy_data variable more
like a 4-byte field. But in each run only a single byte is calculated.
Therefore phy_data content needs to stay the same for at least 3 more
iterations, before the complete set can be uploaded.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
---
BTW: I found Andrew Morton original patch right here:

http://userweb.kernel.org/~akpm/mmotm/broken-out/
drivers-net-wireless-ath-ar9170-phyc-fix-uninitialised-variable.patch
---
diff --git a/drivers/net/wireless/ath/ar9170/phy.c b/drivers/net/wireless/ath/ar9170/phy.c
index b3e5cf3..dbd488d 100644
--- a/drivers/net/wireless/ath/ar9170/phy.c
+++ b/drivers/net/wireless/ath/ar9170/phy.c
@@ -1141,7 +1141,8 @@ static int ar9170_set_freq_cal_data(struct ar9170 *ar,
 	u8 vpds[2][AR5416_PD_GAIN_ICEPTS];
 	u8 pwrs[2][AR5416_PD_GAIN_ICEPTS];
 	int chain, idx, i;
-	u8 f;
+	u32 phy_data = 0;
+	u8 f, tmp;
 
 	switch (channel->band) {
 	case IEEE80211_BAND_2GHZ:
@@ -1208,9 +1209,6 @@ static int ar9170_set_freq_cal_data(struct ar9170 *ar,
 		}
 
 		for (i = 0; i < 76; i++) {
-			u32 phy_data;
-			u8 tmp;
-
 			if (i < 25) {
 				tmp = ar9170_interpolate_val(i, &pwrs[0][0],
 							     &vpds[0][0]);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-29 18:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29 18:47 [PATCH 2.6.32-rc2] ar9170: fix bug in iq-auto calibration value calculation Christian Lamparter

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).