intval = conf->beacon_interval & ATH9K_BEACON_PERIOD;
 
-       /*
-        * It looks like mac80211 may end up using beacon interval of zero in
-        * some cases (at least for mesh point). Avoid getting into an
-        * infinite loop by using a bit safer value instead..
-        */
-       if (intval == 0)
-               intval = 100;
 
        /* Pull nexttbtt forward to reflect the current TSF */
 
                iftype = sc->sc_ah->opmode;
        }
 
+       /*
+        * It looks like mac80211 may end up using beacon interval of zero in
+        * some cases (at least for mesh point). Avoid getting into an
+        * infinite loop by using a bit safer value instead. To be safe,
+        * do sanity check on beacon interval for all operating modes.
+        */
+       if (cur_conf->beacon_interval == 0)
+               cur_conf->beacon_interval = 100;
 
        switch (iftype) {
        case NL80211_IFTYPE_AP: