OSDN Git Service

iwlagn: remove most BUG_ON instances
[android-x86/kernel.git] / drivers / net / wireless / iwlwifi / iwl-sta.c
index bc90a12..3c8cebd 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -233,7 +233,6 @@ u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
        struct iwl_station_entry *station;
        int i;
        u8 sta_id = IWL_INVALID_STATION;
-       u16 rate;
 
        if (is_ap)
                sta_id = ctx->ap_sta_id;
@@ -306,12 +305,6 @@ u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
         */
        iwl_set_ht_add_station(priv, sta_id, sta, ctx);
 
-       /* 3945 only */
-       rate = (priv->band == IEEE80211_BAND_5GHZ) ?
-               IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP;
-       /* Turn on both antennas for the station... */
-       station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK);
-
        return sta_id;
 
 }
@@ -501,7 +494,8 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
 
        priv->num_stations--;
 
-       BUG_ON(priv->num_stations < 0);
+       if (WARN_ON(priv->num_stations < 0))
+               priv->num_stations = 0;
 
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 
@@ -686,7 +680,8 @@ void iwl_dealloc_bcast_stations(struct iwl_priv *priv)
 
                priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE;
                priv->num_stations--;
-               BUG_ON(priv->num_stations < 0);
+               if (WARN_ON(priv->num_stations < 0))
+                       priv->num_stations = 0;
                kfree(priv->stations[i].lq);
                priv->stations[i].lq = NULL;
        }
@@ -782,7 +777,8 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
        spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
 
        iwl_dump_lq_cmd(priv, lq);
-       BUG_ON(init && (cmd.flags & CMD_ASYNC));
+       if (WARN_ON(init && (cmd.flags & CMD_ASYNC)))
+               return -EINVAL;
 
        if (is_lq_table_valid(priv, ctx, lq))
                ret = iwl_send_cmd(priv, &cmd);