Skip to content

Commit

Permalink
mt76: mt7615: check MT76_STATE_PM flag before accessing the device
Browse files Browse the repository at this point in the history
Double-check if the device is in low-power state before accessing
registermap in mt7615_sta_rate_tbl_update() and in
mt7615_led_set_config()

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
Lorenzo Bianconi authored and Felix Fietkau committed Jul 21, 2020
1 parent 1eae3fb commit a2b30bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/wireless/mediatek/mt76/mt7615/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,10 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,
break;
}
msta->n_rates = i;
mt7615_mac_set_rates(phy, msta, NULL, msta->rates);
msta->rate_probe = false;
if (!test_bit(MT76_STATE_PM, &phy->mt76->state)) {
mt7615_mac_set_rates(phy, msta, NULL, msta->rates);
msta->rate_probe = false;
}
spin_unlock_bh(&dev->mt76.lock);
}

Expand Down
4 changes: 4 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ mt7615_led_set_config(struct led_classdev *led_cdev,

mt76 = container_of(led_cdev, struct mt76_dev, led_cdev);
dev = container_of(mt76, struct mt7615_dev, mt76);

if (test_bit(MT76_STATE_PM, &mt76->phy.state))
return;

val = FIELD_PREP(MT_LED_STATUS_DURATION, 0xffff) |
FIELD_PREP(MT_LED_STATUS_OFF, delay_off) |
FIELD_PREP(MT_LED_STATUS_ON, delay_on);
Expand Down

0 comments on commit a2b30bd

Please sign in to comment.