Skip to contentSkip to conversation

Ath9k: fix uninitialized value in ath9k_hw_reset

PATCH In review Jiri Slaby 3 participants 7 messages Oct 10, 2008 Networking drivers (wireless)

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 Ath9k: fix uninitialized value in ath9k_hw_reset

status ath9k_hw_reset() parameter should be set in every case, since it is used in callers to find out an error code.

Cc Luis R. Rodriguez <[email protected]>
Cc Jouni Malinen <[email protected]>
---
 drivers/net/wireless/ath9k/hw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath9k/hw.c +1 -1
index 62e44a0..fb6727b 100644
@@ -5893,7 +5893,7 @@ bool ath9k_hw_reset(struct ath_hal *ah,
 	}
 
 	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
-		return false;
+		FAIL(-EIO);
 
 	if (curchan)
 		ath9k_hw_getnf(ah, curchan);
Signature · 1 line
1.6.0.2
#2 lore raw
In reply to Jiri Slaby

From: Jiri Slaby <[email protected]>
Date: Fri, 10 Oct 2008 19:56:43 +0200

Quoted 15 lines

status ath9k_hw_reset() parameter should be set in every case, since it is used in callers to find out an error code.

Cc Luis R. Rodriguez <[email protected]>
Cc Jouni Malinen <[email protected]>
---
 drivers/net/wireless/ath9k/hw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath9k/hw.c +0 -0
index 62e44a0..fb6727b 100644

drivers/net/wireless/ath9k/hw.c bool ath9k_hw_reset(struct ath_hal *ah, · line 5897

Quoted 6 lines
drivers/net/wireless/ath9k/hw.c +1 -1
@@ -5893,7 +5893,7 @@ bool ath9k_hw_reset(struct ath_hal *ah,
 	}
 
 	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
-		return false;
+		FAIL(-EIO);
 

This fix may be correct, but this is the first time I've noticed these error status updating macros and they are super ugly.

I really think they should be removed. Someone casually scanning this code won't be able to discern the side effects and that makes auditing harder and more error prone.

#3 lore raw
Quoted 28 lines · David Miller

From: Jiri Slaby <[email protected]>
Date: Fri, 10 Oct 2008 19:56:43 +0200

Quoted 15 lines

status ath9k_hw_reset() parameter should be set in every case, since it is used in callers to find out an error code.

Cc Luis R. Rodriguez <[email protected]>
Cc Jouni Malinen <[email protected]>
---
 drivers/net/wireless/ath9k/hw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath9k/hw.c +0 -0
index 62e44a0..fb6727b 100644

drivers/net/wireless/ath9k/hw.c bool ath9k_hw_reset(struct ath_hal *ah, · line 5897

Quoted 6 lines
drivers/net/wireless/ath9k/hw.c +1 -1
@@ -5893,7 +5893,7 @@ bool ath9k_hw_reset(struct ath_hal *ah,
      }
 
      if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
-             return false;
+             FAIL(-EIO);
 

This fix may be correct, but this is the first time I've noticed these error status updating macros and they are super ugly.

Quoted 3 lines

I really think they should be removed. Someone casually scanning this code won't be able to discern the side effects and that makes auditing harder and more error prone.

Agreed, patches welcomed.

Luis

#4 lore raw

From: "Luis R. Rodriguez" <[email protected]>
Date: Fri, 10 Oct 2008 12:00:17 -0700

Quoted 1 line

Agreed, patches welcomed.

Translation: "Fix it yourself if you care so much." :-/

#5 lore raw
Quoted 6 lines · David Miller

From: "Luis R. Rodriguez" <[email protected]>
Date: Fri, 10 Oct 2008 12:00:17 -0700

Quoted 1 line

Agreed, patches welcomed.

Translation: "Fix it yourself if you care so much." :-/

Not really, I want to fix it, just want to fix aggregation too. OK fine, I'll send a patch now.

Luis

#6 lore raw

From: "Luis R. Rodriguez" <[email protected]>
Date: Fri, 10 Oct 2008 12:07:47 -0700

Quoted 9 lines · David Miller
Quoted 6 lines

From: "Luis R. Rodriguez" <[email protected]>
Date: Fri, 10 Oct 2008 12:00:17 -0700

Quoted 1 line

Agreed, patches welcomed.

Translation: "Fix it yourself if you care so much." :-/

Not really, I want to fix it, just want to fix aggregation too.

Ok, as long as your intentions are clear :-)

Quoted 1 line

OK fine, I'll send a patch now.

Thank you.