aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2009-08-26 22:30:00 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-28 14:40:54 -0400
commit3b3ee43da43aca1cbf4c3651379b2b1492e49dd6 (patch)
tree2b2ffa22c55e817f168dbf1e179ead2050fca7ec
parentca5efbe243dde7d269b6bbae7feaa5e4740db36e (diff)
ath5k: fix uninitialized value use in ath5k_eeprom_read_turbo_modes()
The `val' variable in ath5k_eeprom_read_turbo_modes() is used uninitialized. gcc 4.4.1 with -fno-inline-functions-called-once reports it: eeprom.c: In function 'ath5k_eeprom_read_turbo_modes': eeprom.c:441: warning: 'val' may be used uninitialized in this function Comparing the code to the Atheros HAL, it's clear that the split between ath5k_eeprom_read_modes() and ath5k_eeprom_read_turbo_modes() was incorrect. The Atheros HAL reads both turbo and non-turbo data from EEPROM in one function. Some turbo mode parameters are derived from the same EEPROM values as non-turbo parameters, just from different bits. Merge ath5k_eeprom_read_turbo_modes() into ath5k_eeprom_read_modes() to fix the warning. The actual values and offsets have been cross-checked against Atheros HAL. Signed-off-by: Pavel Roskin <proski@gnu.org> Acked-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath5k/eeprom.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index 8af477dd6fc7..644962adda97 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -414,27 +414,11 @@ static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset,
414 break; 414 break;
415 } 415 }
416 416
417done: 417 /*
418 /* return new offset */ 418 * Read turbo mode information on newer EEPROM versions
419 *offset = o; 419 */
420
421 return 0;
422}
423
424/*
425 * Read turbo mode information on newer EEPROM versions
426 */
427static int
428ath5k_eeprom_read_turbo_modes(struct ath5k_hw *ah,
429 u32 *offset, unsigned int mode)
430{
431 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
432 u32 o = *offset;
433 u16 val;
434 int ret;
435
436 if (ee->ee_version < AR5K_EEPROM_VERSION_5_0) 420 if (ee->ee_version < AR5K_EEPROM_VERSION_5_0)
437 return 0; 421 goto done;
438 422
439 switch (mode){ 423 switch (mode){
440 case AR5K_EEPROM_MODE_11A: 424 case AR5K_EEPROM_MODE_11A:
@@ -468,6 +452,7 @@ ath5k_eeprom_read_turbo_modes(struct ath5k_hw *ah,
468 break; 452 break;
469 } 453 }
470 454
455done:
471 /* return new offset */ 456 /* return new offset */
472 *offset = o; 457 *offset = o;
473 458
@@ -504,10 +489,6 @@ ath5k_eeprom_init_modes(struct ath5k_hw *ah)
504 ret = ath5k_eeprom_read_modes(ah, &offset, mode); 489 ret = ath5k_eeprom_read_modes(ah, &offset, mode);
505 if (ret) 490 if (ret)
506 return ret; 491 return ret;
507
508 ret = ath5k_eeprom_read_turbo_modes(ah, &offset, mode);
509 if (ret)
510 return ret;
511 } 492 }
512 493
513 /* override for older eeprom versions for better performance */ 494 /* override for older eeprom versions for better performance */