[PATCH 61/61] staging: rtl8723bs: fix tx power limit lookup by using correct channel index

From: Arsenii Pashchenko

Date: Wed Jul 15 2026 - 09:06:56 EST


In phy_get_tx_pwr_lmt(), the result of phy_GetChannelIndexOfTxPowerLimit()
is erroneously assigned back to the input parameter 'channel'.

Since 'channel' is never used again afterward, this triggers a
-Wunused-but-set-parameter compiler warning. Furthermore, the actual
index variable 'idx_channel' remains initialized to -1, causing the
function to always fail the subsequent validation check and prematurely
return MAX_POWER_INDEX.

Fix this by assigning the computed channel index directly to 'idx_channel'.
This resolves the compiler warning and restores the intended hardware
tx power limit lookup logic.

Signed-off-by: Arsenii Pashchenko <ulijg308@xxxxxxxxx>
---
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index 7ad04aa85..bbaedf256 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -718,7 +718,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
if (idx_rate_sctn == 0 || idx_rate_sctn == 1)
idx_bandwidth = 0;

- channel--;
+ idx_channel--;

if (idx_regulation == -1 || idx_bandwidth == -1 ||
idx_rate_sctn == -1 || idx_channel == -1)
--
2.55.0