]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: rtl8723bs: remove duplicate rate checks in PHY_GetTxPowerIndexBase()
authorPrithvi Tambewagh <activprithvi@gmail.com>
Thu, 9 Apr 2026 13:50:26 +0000 (19:20 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Apr 2026 11:01:55 +0000 (05:01 -0600)
The code previously checked (Rate >= MGN_MCS0 && Rate <= MGN_MCS7)
condition twice - once for the (BandWidth == CHANNEL_WIDTH_20) check and
once for the (BandWidth == CHANNEL_WIDTH_40) check. Fix if statement
formatting to move that if check as an outer if check to improve code
formatting.

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
Link: https://patch.msgid.link/20260409135026.137904-6-activprithvi@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c

index 2746da0a9846fdba1c0300dc69da0b26cc47e65a..45dbe1782bae48f3bebdaa3c661241b23baa008b 100644 (file)
@@ -473,11 +473,10 @@ u8 PHY_GetTxPowerIndexBase(
        if ((Rate >= MGN_6M && Rate <= MGN_54M) && !IS_CCK_RATE(Rate))
                txPower += pHalData->OFDM_24G_Diff[RFPath][TX_1S];
 
-       if (BandWidth == CHANNEL_WIDTH_20) { /*  BW20-1S, BW20-2S */
-               if (MGN_MCS0 <= Rate && Rate <= MGN_MCS7)
+       if (Rate >= MGN_MCS0 && Rate <= MGN_MCS7) {
+               if (BandWidth == CHANNEL_WIDTH_20) /*  BW20-1S, BW20-2S */
                        txPower += pHalData->BW20_24G_Diff[RFPath][TX_1S];
-       } else if (BandWidth == CHANNEL_WIDTH_40) { /*  BW40-1S, BW40-2S */
-               if (MGN_MCS0 <= Rate && Rate <= MGN_MCS7)
+               else if (BandWidth == CHANNEL_WIDTH_40) /*  BW40-1S, BW40-2S */
                        txPower += pHalData->BW40_24G_Diff[RFPath][TX_1S];
        }