[J][PATCH 6/8] mt76: mt7921: honor mt76_connac_mcu_set_rate_txpower return value in mt7921_config

Aaron Ma aaron.ma at canonical.com
Mon Nov 21 05:53:33 UTC 2022


From: Lorenzo Bianconi <lorenzo at kernel.org>

BugLink: https://bugs.launchpad.net/bugs/1997200

Check return code from mt76_connac_mcu_set_rate_txpower() in mt7921_config
routine.

Signed-off-by: Lorenzo Bianconi <lorenzo at kernel.org>
Signed-off-by: Felix Fietkau <nbd at nbd.name>
(cherry picked from commit 5d461321c93013edf839a7a3fea2845cc3073ca8)
Signed-off-by: Aaron Ma <aaron.ma at canonical.com>
---
 drivers/net/wireless/mediatek/mt76/mt7921/main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index f5ea4405db11b..65ec943b9c252 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -455,7 +455,7 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct mt7921_dev *dev = mt7921_hw_dev(hw);
 	struct mt7921_phy *phy = mt7921_hw_phy(hw);
-	int ret;
+	int ret = 0;
 
 	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
 		ieee80211_stop_queues(hw);
@@ -467,8 +467,11 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
 
 	mt7921_mutex_acquire(dev);
 
-	if (changed & IEEE80211_CONF_CHANGE_POWER)
-		mt76_connac_mcu_set_rate_txpower(phy->mt76);
+	if (changed & IEEE80211_CONF_CHANGE_POWER) {
+		ret = mt76_connac_mcu_set_rate_txpower(phy->mt76);
+		if (ret)
+			goto out;
+	}
 
 	if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
 		bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR);
@@ -483,9 +486,10 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
 		mt76_wr(dev, MT_WF_RFCR(0), phy->rxfilter);
 	}
 
+out:
 	mt7921_mutex_release(dev);
 
-	return 0;
+	return ret;
 }
 
 static int
-- 
2.34.1




More information about the kernel-team mailing list