[PATCH wireless] wifi: mt76: mt7925: check drv_pmctrl return in the PCIe reset path

Devin Wittmayer lucid_duck at justthetip.ca
Sun Aug 9 13:55:59 PDT 2026


mt7925e_mac_reset() ignores what mt792xe_mcu_drv_pmctrl() returns. It
checks both pmctrl calls it makes later in the same function, and probe,
suspend and resume check theirs. mt7925e_unregister_device() also discards
it, but there the device is going away and teardown has to continue
regardless.

When 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
calling mt7925_run_firmware() on a chip the driver does not own.

On an MT7925 with MT_CONN_ON_LPCTL held asserted, a triggered reset failed
the handshake 4 times. Each failure was followed within 85 ms by both
firmware stages loading:

  mt7925e 0000:0a:00.0: driver own failed
  mt7925e 0000:0a:00.0: HW/SW Version: 0x8a108a10, Build Time: [...]
  mt7925e 0000:0a:00.0: WM Firmware Version: ____000000, Build Time: [...]

With the return checked, 8 handshake failures were followed by no firmware
load. The one load in that run came after a handshake that succeeded.

Return the error instead. The call is the first statement in the function,
before MT76_RESET is set and before the TX worker and NAPI are disabled, so
bailing out there leaves them untouched. This does not fix why the
handshake fails.

Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Devin Wittmayer <lucid_duck at justthetip.ca>
---
 drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c
index 97683949a305..2ce9ad0350ef 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c
@@ -73,7 +73,9 @@ int mt7925e_mac_reset(struct mt792x_dev *dev)
 	const struct mt792x_irq_map *irq_map = dev->irq_map;
 	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.55.0




More information about the Linux-mediatek mailing list