From f271ce48d73b97605d6d14f3cab2d65ad7455ddd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Sep 2025 06:35:24 +0200 Subject: [PATCH] mt76: mt7996: fix unsigned comparison Fixes detecing error condition from get_own_mld_idx Fixes: 110ecc331123 ("wifi: mt76: mt7996: Fix mt7996_mcu_bss_mld_tlv routine") Signed-off-by: Felix Fietkau --- mt7996/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mt7996/main.c b/mt7996/main.c index 46a85927..ad742646 100644 --- a/mt7996/main.c +++ b/mt7996/main.c @@ -301,7 +301,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif, struct mt7996_dev *dev = phy->dev; u8 band_idx = phy->mt76->band_idx; struct mt76_txq *mtxq; - int idx, ret; + int mld_idx, idx, ret; mlink->idx = __ffs64(~dev->mt76.vif_mask); if (mlink->idx >= mt7996_max_interface_num(dev)) @@ -316,10 +316,12 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif, mvif->mld_remap_idx = get_free_idx(dev->mld_remap_idx_mask, 0, 15); } - link->mld_idx = get_own_mld_idx(dev->mld_idx_mask, false); - if (link->mld_idx < 0) + + mld_idx = get_own_mld_idx(dev->mld_idx_mask, false); + if (mld_idx < 0) return -ENOSPC; + link->mld_idx = mld_idx; link->phy = phy; mlink->omac_idx = idx; mlink->band_idx = band_idx;