[PATCH] wifi: rtw88: Unregister all hardware state when PCI IRQ setup fails

From: Shuo Qin

Date: Sat Dec 05 2026 - 04:55:28 EST


rtw_register_hw() registers the LED class device and creates debugfs
entries as well as registering the mac80211 hardware. If the following
IRQ request fails, rtw_pci_probe() only calls ieee80211_unregister_hw()
before freeing the hardware and its private driver state.

The LED remains registered with callbacks that access the freed rtw_dev.
Use rtw_unregister_hw() to undo the complete registration, including the
LED and debugfs state, before releasing the allocation.

Fixes: 4b6652bc6d8d ("wifi: rtw88: Add support for LED blinking")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Bin Yu <byu@xxxxxxxxxxxxx>
Signed-off-by: Bin Yu <byu@xxxxxxxxxxxxx>
Co-developed-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Shuo Qin <23159100078@xxxxxxxxxxxxxxxxx>
---
drivers/net/wireless/realtek/rtw88/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 66d2e5f514447b9779d1f58f8fe9a4a647df7850..e6ee32d59c11ced61223d0f26523cf091aaf3bea 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -1897,7 +1897,7 @@ int rtw_pci_probe(struct pci_dev *pdev,

ret = rtw_pci_request_irq(rtwdev, pdev);
if (ret) {
- ieee80211_unregister_hw(hw);
+ rtw_unregister_hw(rtwdev, hw);
goto err_destroy_pci;
}

--
2.34.1