Skip to contentSkip to conversation

net: wireless: ath9k: Return an error when ath9k_hw_reset() fails

PATCH In review Jia-Ju Bai 3 participants 3 messages May 4, 2019 – May 6, 2019

Subsystems (3)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 net: wireless: ath9k: Return an error when ath9k_hw_reset() fails

ath9k_hw_reset() in ath9k_start() can fail, and in this case, ath9k_start() should return an error instead of executing the subsequent code.

---
 drivers/net/wireless/ath/ath9k/main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath9k/main.c +1 -0
index f23cb2f3d296..f78e7c46764d 100644
@@ -681,6 +681,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 			"Unable to reset hardware; reset status %d (freq %u MHz)\n",
 			r, curchan->center_freq);
 		ah->reset_power_on = false;
+		return r;
 	}
 
 	/* Setup our intr mask. */
Signature · 1 line
2.17.0
#1 lore raw
Quoted 4 lines · Jia-Ju Bai

ath9k_hw_reset() in ath9k_start() can fail, and in this case, ath9k_start() should return an error instead of executing the subsequent code.

Such mechanical patches w/o understanding the code are always problematic. Do you have any proof that this error is fatal? I think it is not, else we wouldn't have this line:
ah->reset_power_on = false;
Also you should consider that a mutex and a spinlock are held. Maybe changing the error message to a warning would be more appropriate. But this I would leave to somebody being more familiar with this driver.

Quoted 18 lines
---
 drivers/net/wireless/ath/ath9k/main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath9k/main.c +1 -0
index f23cb2f3d296..f78e7c46764d 100644
@@ -681,6 +681,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 			"Unable to reset hardware; reset status %d (freq %u MHz)\n",
 			r, curchan->center_freq);
 		ah->reset_power_on = false;
+		return r;
 	}
 
 	/* Setup our intr mask. */
#2 lore raw
Quoted 5 lines · Heiner Kallweit
Quoted 4 lines · Jia-Ju Bai

ath9k_hw_reset() in ath9k_start() can fail, and in this case, ath9k_start() should return an error instead of executing the subsequent code.

Quoted 8 lines

Such mechanical patches w/o understanding the code are always problematic. Do you have any proof that this error is fatal? I think it is not, else we wouldn't have this line:
ah->reset_power_on = false;
Also you should consider that a mutex and a spinlock are held. Maybe changing the error message to a warning would be more appropriate. But this I would leave to somebody being more familiar with this driver.

A very good point, thanks Heiner! I will drop this unless someone familiar with ath9k says that this is ok.

Signature · 1 line
Kalle Valo