struct ath12k_peer *peer;
        int ret = 0;
 
-       /* cancel must be done outside the mutex to avoid deadlock */
-       if ((old_state == IEEE80211_STA_NONE &&
-            new_state == IEEE80211_STA_NOTEXIST))
-               wiphy_work_cancel(hw->wiphy, &arsta->update_wk);
-
        ar = ath12k_get_ar_by_vif(hw, vif);
        if (!ar) {
                WARN_ON_ONCE(1);
                                    sta->addr, arvif->vdev_id);
        } else if ((old_state == IEEE80211_STA_NONE &&
                    new_state == IEEE80211_STA_NOTEXIST)) {
+               wiphy_work_cancel(hw->wiphy, &arsta->update_wk);
+
                if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
                        ath12k_bss_disassoc(ar, arvif);
                        ret = ath12k_mac_vdev_stop(arvif);