staging: rtl8723bs: remove dead 5GHz fallback in GetDeltaSwingTable_8723B
PATCH 1/1 staging: rtl8723bs: remove dead 5GHz fallback in GetDeltaSwingTable_8723B
GetDeltaSwingTable_8723B() falls back to calibration tables from a different chip (8188E) when channel is outside the range of 1 to 14:
} else {
*TemperatureUP_A = (u8 *)DeltaSwingTableIdx_2GA_P_8188E;
...
}This branch is unreachable. channel comes from CurrentChannel, which is only updated in rtl8723b_phycfg.c after passing HAL_IsLegalChannel(), which enforces a range of 1 to 14. Since RTL8723BS is a 2.4GHz-only chip [1][2], with no 5GHz support, CurrentChannel can never exceed the range of 1 to 14, so this fallback branch can never execute.
See discussion at [3] for the full reasoning.
Also remove the two DeltaSwingTableIdx_*_8188E arrays that were only used by this branch, along with a comment referencing a TxPowerTrack.txt config file — no such file-reading logic exists anywhere in this driver, so the comment is stale as well.
[1] https://www.realtek.com/Product/Index?id=610&cate_id=194
[2] https://fccid.io/TX2-RTL8723BS/User-Manual/User-Manual-System-pdf-2365682
[3] https://lore.kernel.org/linux-staging/2026090527-outdoors-press-9602@gregkh/T/#t
--- .../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 19 ------------------- 1 file changed, 19 deletions(-)
drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c +0 -19
@@ -21,20 +21,6 @@#define PATH_S1 0/* RF_PATH_A */ #define IDX_0xC4C 2 -/*---------------------------Define Local Constant---------------------------*/ - -/* In the case that we fail to read TxPowerTrack.txt, we use the table for -* 88E as the default table. -*/ -static u8 DeltaSwingTableIdx_2GA_N_8188E[] = { -0 ,0 ,0 ,2 ,2 ,3 ,3 ,4 ,4 ,4 ,4 ,5 ,5 ,6 ,6 , -7 ,7 ,7 ,7 ,8 ,8 ,9 ,9 ,10 ,10 ,10 ,11 ,11 ,11 ,11 -}; -static u8 DeltaSwingTableIdx_2GA_P_8188E[] = { -0 ,0 ,0 ,0 ,1 ,1 ,2 ,2 ,3 ,3 ,4 ,4 ,4 ,4 ,4 , -4 ,4 ,4 ,5 ,5 ,7 ,7 ,8 ,8 ,8 ,9 ,9 ,9 ,9 ,9 -}; -/* 3 ============================================================ */ /* 3 Tx Power Tracking */ /* 3 ============================================================ */
@@ -312,11 +298,6 @@ static void GetDeltaSwingTable_8723B( *TemperatureUP_B = pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P; *TemperatureDOWN_B = pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N; } - }else { - *TemperatureUP_A = (u8 *)DeltaSwingTableIdx_2GA_P_8188E; - *TemperatureDOWN_A = (u8 *)DeltaSwingTableIdx_2GA_N_8188E; - *TemperatureUP_B = (u8 *)DeltaSwingTableIdx_2GA_P_8188E; - *TemperatureDOWN_B = (u8 *)DeltaSwingTableIdx_2GA_N_8188E; } }
Signature · 1 line
2.43.0
Quoted 3 lines
This branch is unreachable.
channelcomes fromCurrentChannel, which is only updated inrtl8723b_phycfg.cafter passingHAL_IsLegalChannel(), which enforces a range of 1 to 14
if ((!Adapter->driver_stopped) && (!Adapter->bSurpriseRemoved)) {
phy_SwChnlAndSetBwMode8723B(Adapter);
} else {
if (pHalData->bSwChnl) {
pHalData->CurrentChannel = tmpChannel;
pHalData->CurrentCenterFrequencyIndex1 = tmpChannel;
}
if (pHalData->bSetChnlBW) {
pHalData->CurrentChannelBW = tmpBW;
pHalData->nCur40MhzPrimeSC = tmpnCur40MhzPrimeSC;
pHalData->nCur80MhzPrimeSC = tmpnCur80MhzPrimeSC;
pHalData->CurrentCenterFrequencyIndex1 = tmpCenterFrequencyIndex1;
}
}In else branch pHalData->bSwChnl is still true.
It is possible to write an invalid value to pHalData->CurrentChannel with PHY_HandleSwChnlAndSetBW8723B().
Thanks,
Bera
Hi Bera,
Thanks for catching this — you're right, and I missed something important in my analysis. bSwChnl isn't reset to false when HAL_IsLegalChannel() rejects a channel, so an unvalidated ChannelNum can still reach CurrentChannel through a stale bSwChnl state. This branch is a defensive fallback, not dead code.
I'm withdrawing this patch. Thanks again for the careful review.
Thanks,
Hank