]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtlwifi: rtl8821ae: Remove dead code in rtl8821ae_update_hal_rate_table()
authorChelsy Ratnawat <chelsyratnawat2001@gmail.com>
Tue, 7 Apr 2026 12:34:27 +0000 (05:34 -0700)
committerPing-Ke Shih <pkshih@realtek.com>
Wed, 29 Apr 2026 02:53:50 +0000 (10:53 +0800)
The variable 'mimo_ps' is initialized to IEEE80211_SMPS_OFF and never
modified throughout the function. This makes the condition checking for
IEEE80211_SMPS_STATIC always evaluate to false, rendering the entire
if-branch unreachable dead code.

The error was reported by Coverity Scan.

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260407123427.14612-1-chelsyratnawat2001@gmail.com
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c

index 3a4a334762055319ddb5d3e8645dfdf6180fbd19..c4dcae2d375edd07940b8ffdd14150b07bed33d2 100644 (file)
@@ -3257,9 +3257,9 @@ static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw,
        u32 ratr_value;
        u8 ratr_index = 0;
        u8 b_nmode = mac->ht_enable;
-       u8 mimo_ps = IEEE80211_SMPS_OFF;
        u16 shortgi_rate;
        u32 tmp_ratr_value;
+       u32 ratr_mask;
        u8 curtxbw_40mhz = mac->bw_40;
        u8 b_curshortgi_40mhz = (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
                                1 : 0;
@@ -3288,19 +3288,14 @@ static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw,
        case WIRELESS_MODE_N_24G:
        case WIRELESS_MODE_N_5G:
                b_nmode = 1;
-               if (mimo_ps == IEEE80211_SMPS_STATIC) {
-                       ratr_value &= 0x0007F005;
-               } else {
-                       u32 ratr_mask;
 
-                       if (get_rf_type(rtlphy) == RF_1T2R ||
-                           get_rf_type(rtlphy) == RF_1T1R)
-                               ratr_mask = 0x000ff005;
-                       else
-                               ratr_mask = 0x0f0ff005;
+               if (get_rf_type(rtlphy) == RF_1T2R ||
+                   get_rf_type(rtlphy) == RF_1T1R)
+                       ratr_mask = 0x000ff005;
+               else
+                       ratr_mask = 0x0f0ff005;
 
-                       ratr_value &= ratr_mask;
-               }
+               ratr_value &= ratr_mask;
                break;
        default:
                if (rtlphy->rf_type == RF_1T2R)