[PATCH wireless] wifi: mt76: mt7921: check drv_pmctrl return in the PCIe reset path
Devin Wittmayer
lucid_duck at justthetip.ca
Sat Aug 8 18:23:09 PDT 2026
mt7921e_mac_reset() ignores what mt792xe_mcu_drv_pmctrl() returns. The
probe, suspend and resume paths all check it. The only other caller that
does not is mt7921e_unregister_device(), where the device is going away.
If the driver-own handshake does not complete, __mt792xe_mcu_drv_pmctrl()
gives up after MT792x_DRV_OWN_RETRY_COUNT and returns -EIO without
reinitialising WPDMA or clearing MT76_STATE_PM. The reset continues anyway,
writing interrupt enable registers, cycling NAPI, resetting WPDMA and
downloading firmware to a chip the driver does not own.
On an MT7922 with MT_CONN_ON_LPCTL held asserted, a triggered reset gave 8
ownership failures, each followed by an MCU timeout and a failed firmware
download:
mt7921e 0000:04:00.0: driver own failed
mt7921e 0000:04:00.0: Message 00000010 (seq 7) timeout
mt7921e 0000:04:00.0: Failed to get patch semaphore
With the return checked, 26 ownership failures produced no firmware
download, and mt7921_mac_reset_work() got as far as logging "chip reset
failed", which it never did otherwise.
The call sits before any teardown, so returning early leaves NAPI and the
TX worker alone. This does not fix why the handshake fails.
Reported-by: moosager <moosager90 at gmail.com>
Link: https://lore.kernel.org/linux-wireless/anG46qbvCqCHGF-f@fedora.fritz.box/
Fixes: dfc7743de1eb ("mt76: mt7921: refactor mcu.c to be bus independent")
Signed-off-by: Devin Wittmayer <lucid_duck at justthetip.ca>
---
drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
index 0db7acb3a637..c4261f66f469 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
@@ -57,7 +57,9 @@ int mt7921e_mac_reset(struct mt792x_dev *dev)
{
int i, err;
- mt792xe_mcu_drv_pmctrl(dev);
+ err = mt792xe_mcu_drv_pmctrl(dev);
+ if (err)
+ return err;
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
--
2.54.0
More information about the Linux-mediatek
mailing list