* [PATCH] staging: rtl8723bs: remove dead 5GHz fallback in GetDeltaSwingTable_8723B
@ 2026-09-06 4:20 Hank Yang
2026-09-06 11:29 ` b9788213
0 siblings, 1 reply; 3+ messages in thread
From: Hank Yang @ 2026-09-06 4:20 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, b9788213, guojy.bj, Hank Yang
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
Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Hank Yang <s950343@gmail.com>
---
.../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
index 6c5f56d5a1f4..394ee4e732a6 100644
--- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
+++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
@@ -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;
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] staging: rtl8723bs: remove dead 5GHz fallback in GetDeltaSwingTable_8723B
2026-09-06 4:20 [PATCH] staging: rtl8723bs: remove dead 5GHz fallback in GetDeltaSwingTable_8723B Hank Yang
@ 2026-09-06 11:29 ` b9788213
2026-09-06 12:46 ` Hank Yang
0 siblings, 1 reply; 3+ messages in thread
From: b9788213 @ 2026-09-06 11:29 UTC (permalink / raw)
To: s950343; +Cc: gregkh, linux-staging, b9788213, guojy.bj
> 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
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] staging: rtl8723bs: remove dead 5GHz fallback in GetDeltaSwingTable_8723B
2026-09-06 11:29 ` b9788213
@ 2026-09-06 12:46 ` Hank Yang
0 siblings, 0 replies; 3+ messages in thread
From: Hank Yang @ 2026-09-06 12:46 UTC (permalink / raw)
To: b9788213; +Cc: gregkh, linux-staging, guojy.bj
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-06 12:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-06 4:20 [PATCH] staging: rtl8723bs: remove dead 5GHz fallback in GetDeltaSwingTable_8723B Hank Yang
2026-09-06 11:29 ` b9788213
2026-09-06 12:46 ` Hank Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox