From: Chih-Kang Chang <gary.chang@xxxxxxxxxxx> When scan happens before suspending, rtw89_hw_scan_complete() might happen after suspend flow. This causes the scan to be unable to properly indicate scan completion to mac80211 before suspending. To fix this issue, we modify to execute rtw89_hw_scan_complete() when rtw89_hw_scan_abort() is called, regardless of result of rtw89_hw_scan_offload(). Cc: stable@xxxxxxxxxxxxxxx Fixes: bcbefbd032df ("wifi: rtw89: add wait/completion for abort scan") Signed-off-by: Chih-Kang Chang <gary.chang@xxxxxxxxxxx> Signed-off-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx> --- drivers/net/wireless/realtek/rtw89/fw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 044a5b90c7f4..e9aa5bdeb5d7 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -6212,7 +6212,7 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, .aborted = aborted, }; - if (!vif) + if (!vif || !rtwdev->scanning) return; rtw89_write32_mask(rtwdev, @@ -6245,7 +6245,9 @@ void rtw89_hw_scan_abort(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif) ret = rtw89_hw_scan_offload(rtwdev, vif, false); if (ret) - rtw89_hw_scan_complete(rtwdev, vif, true); + rtw89_warn(rtwdev, "rtw89_hw_scan_offload failed ret %d\n", ret); + + rtw89_hw_scan_complete(rtwdev, vif, true); } static bool rtw89_is_any_vif_connected_or_connecting(struct rtw89_dev *rtwdev) -- 2.25.1