From: Jared Huang Use min(batch_len, n_chan - idx) so the last batch always holds the channels that are left. Also add the missing 5.9G channel list. Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Signed-off-by: Jared Huang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index f45b0d81fd08..80a4f395c472 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -4140,7 +4140,8 @@ mt7925_mcu_rate_txpower_band(struct mt76_phy *phy, 112, 114, 116, 118, 120, 122, 124, 126, 128, 132, 134, 136, 138, 140, 142, 144, 149, 151, 153, 155, 157, - 159, 161, 165, 167 + 159, 161, 163, 165, 167, 169, 173, + 175, 177 }; static const u8 chan_list_6ghz[] = { 1, 3, 5, 7, 9, 11, 13, @@ -4199,7 +4200,7 @@ mt7925_mcu_rate_txpower_band(struct mt76_phy *phy, int j, msg_len, num_ch; struct sk_buff *skb; - num_ch = i == batch_size - 1 ? n_chan % batch_len : batch_len; + num_ch = min(batch_len, n_chan - idx); msg_len = sizeof(*tx_power_tlv) + num_ch * sku_len; skb = mt76_mcu_msg_alloc(dev, NULL, msg_len); if (!skb) { -- 2.45.2