cfg80211: fix bug while trying to process beacon hints on init
[pandora-kernel.git] / net / wireless / reg.c
index 3a73494..974b127 100644 (file)
@@ -1134,7 +1134,8 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
        if (is_world_regdom(cfg80211_regdomain->alpha2) ||
            (wiphy->regd && is_world_regdom(wiphy->regd->alpha2)))
                return true;
-       if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
+       if (last_request &&
+           last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
            wiphy->custom_regulatory)
                return true;
        return false;
@@ -1143,6 +1144,12 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
 /* Reap the advantages of previously found beacons */
 static void reg_process_beacons(struct wiphy *wiphy)
 {
+       /*
+        * Means we are just firing up cfg80211, so no beacons would
+        * have been processed yet.
+        */
+       if (!last_request)
+               return;
        if (!reg_is_world_roaming(wiphy))
                return;
        wiphy_update_beacon_reg(wiphy);