summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7615/main.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-05-03 15:54:36 +0300
committerFelix Fietkau <nbd@nbd.name>2019-06-25 12:55:25 +0200
commitb1571a0e77d8cef14227af293c6dda1464a57270 (patch)
treecdf474bbcbea306af3768044726e09c68a0e2c5f /drivers/net/wireless/mediatek/mt76/mt7615/main.c
parent4875e34679ba259bb8fa6a3ac337d76c8b7283a9 (diff)
downloadlinux-stable-b1571a0e77d8cef14227af293c6dda1464a57270.tar.gz
linux-stable-b1571a0e77d8cef14227af293c6dda1464a57270.tar.bz2
linux-stable-b1571a0e77d8cef14227af293c6dda1464a57270.zip
mt76: Fix a signedness bug in mt7615_add_interface()
The problem is that "mvif->omac_idx" is a u8 so it can't be negative and the error handling won't work. The get_omac_idx() function returns -1 on error. Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615/main.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 80e6b211f60b..8d7a47d1b205 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -77,11 +77,12 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
goto out;
}
- mvif->omac_idx = get_omac_idx(vif->type, dev->omac_mask);
- if (mvif->omac_idx < 0) {
+ idx = get_omac_idx(vif->type, dev->omac_mask);
+ if (idx < 0) {
ret = -ENOSPC;
goto out;
}
+ mvif->omac_idx = idx;
/* TODO: DBDC support. Use band 0 and wmm 0 for now */
mvif->band_idx = 0;