From: Ching-Te Ku When a BT device is disabled, _update_bt_link_cnt() is no longer called for that device, so its link_weight[] retains stale values from the last active period. _set_bind_info() then computes a non-zero band score for the disabled device, which can lead to an incorrect tdd_bind.rf_band selection and ultimately wrong coexistence policy. Clear link_weight[] for any disabled BT device at the start of the _set_bind_info() loop so that stale scores are not carried forward. Signed-off-by: Ching-Te Ku Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/coex.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c index d5b1c68539d9..ac3d0c63f930 100644 --- a/drivers/net/wireless/realtek/rtw89/coex.c +++ b/drivers/net/wireless/realtek/rtw89/coex.c @@ -8167,6 +8167,10 @@ static void _set_bind_info(struct rtw89_btc *btc, u8 type) memset(bd, 0, sizeof(*bd)); /* compare BT 2GHz/5GHz profile by link-weighting */ for (i = 0; i < BTC_BT_BMAX; i++) { + if (!cx->bt0.enable.now) + cx->bt0.link_weight[i] = 0; + if (!cx->bt1.enable.now) + cx->bt1.link_weight[i] = 0; link_weight[BTC_BT_1ST][i] = cx->bt0.link_weight[i]; link_weight[BTC_BT_2ND][i] = cx->bt1.link_weight[i]; link_weight[BTC_BT_EXT][i] = cx->bt_ext.link_weight[i]; -- 2.25.1