summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-05-02 01:16:10 +0200
committerFelix Fietkau <nbd@nbd.name>2020-05-12 19:52:34 +0200
commitcc5f58aee180f1f8dbdbc136ecb3cdd190b29068 (patch)
treebe7eab3f13d7086abac9ca943442c19b969639c3 /drivers
parenteb7bd8d7fb727dcdbf4b1c145bba1169bc3c2d4a (diff)
mt76: mt7615: check return value of mt7615_eeprom_get_power_index
mt7615_eeprom_get_power_index can return negative error value. Check mt7615_eeprom_get_power_index return value before using it Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
index 81294bb2b06b..d831d647d237 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
@@ -247,6 +247,9 @@ void mt7615_init_txpower(struct mt7615_dev *dev,
int index;
index = mt7615_eeprom_get_power_index(dev, chan, j);
+ if (index < 0)
+ continue;
+
target_power = max(target_power, eep[index]);
}