aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2009-03-07 04:26:42 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:36 -0400
commit8d6c39efed5987d3c1ade96e93753125a099f512 (patch)
tree588f33c4f9e0c64aca810718b8b2c60a929ba1bb /drivers
parent2c91108c55477334f6854a587ec6e9111d8f1407 (diff)
ath5k: don't change mac in eeprom_read_mac on error
Do not touch mac parameter passed to ath5k_eeprom_read_mac unless we are sure we have correct address. I.e. when returning error, do not change it. While at it, use '= {}' compiler trick for memsetting mac_d. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Cc: Luis R. Rodriguez <lrodriguez@atheros.com> Acked-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath5k/eeprom.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath5k/eeprom.c b/drivers/net/wireless/ath5k/eeprom.c
index a54ee7e4967b..ac45ca47ca87 100644
--- a/drivers/net/wireless/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath5k/eeprom.c
@@ -1418,14 +1418,11 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
1418 */ 1418 */
1419int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) 1419int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
1420{ 1420{
1421 u8 mac_d[ETH_ALEN]; 1421 u8 mac_d[ETH_ALEN] = {};
1422 u32 total, offset; 1422 u32 total, offset;
1423 u16 data; 1423 u16 data;
1424 int octet, ret; 1424 int octet, ret;
1425 1425
1426 memset(mac, 0, ETH_ALEN);
1427 memset(mac_d, 0, ETH_ALEN);
1428
1429 ret = ath5k_hw_eeprom_read(ah, 0x20, &data); 1426 ret = ath5k_hw_eeprom_read(ah, 0x20, &data);
1430 if (ret) 1427 if (ret)
1431 return ret; 1428 return ret;
@@ -1441,11 +1438,11 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
1441 octet += 2; 1438 octet += 2;
1442 } 1439 }
1443 1440
1444 memcpy(mac, mac_d, ETH_ALEN);
1445
1446 if (!total || total == 3 * 0xffff) 1441 if (!total || total == 3 * 0xffff)
1447 return -EINVAL; 1442 return -EINVAL;
1448 1443
1444 memcpy(mac, mac_d, ETH_ALEN);
1445
1449 return 0; 1446 return 0;
1450} 1447}
1451 1448