chan->beacon_found = true;
 
+       if (!reg_is_world_roaming(wiphy))
+               return;
+
        if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS)
                return;
 
         */
        if (!last_request)
                return;
-       if (!reg_is_world_roaming(wiphy))
-               return;
        wiphy_update_beacon_reg(wiphy);
 }
 
        struct cfg80211_registered_device *rdev;
        struct reg_beacon *pending_beacon, *tmp;
 
-       /*
-        * No need to hold the reg_mutex here as we just touch wiphys
-        * and do not read or access regulatory variables.
-        */
        mutex_lock(&cfg80211_mutex);
+       mutex_lock(®_mutex);
 
        /* This goes through the _pending_ beacon list */
        spin_lock_bh(®_pending_beacons_lock);
        }
 
        spin_unlock_bh(®_pending_beacons_lock);
+       mutex_unlock(®_mutex);
        mutex_unlock(&cfg80211_mutex);
 }