]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iwlwifi: mvm: fix uninitialized var while waiting for queues to empty
authorSharon Dvir <sharon.dvir@intel.com>
Mon, 12 Jun 2017 08:40:33 +0000 (11:40 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 1 Aug 2017 09:41:44 +0000 (12:41 +0300)
While waiting for queues to empty,
If txq_id == IWL_MVM_INVALID_QUEUE for all txq_ids,
ret is used uninitialized.
Found by Klocwork.

Fixes: d6d517b7730c ("iwlwifi: add wait for tx queue empty")
Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/sta.c

index 4adc8fecfaefe352f0186dec28171ed222ac3331..b196acd18252c8b0d01758d1cc1e18124aaa6c88 100644 (file)
@@ -1619,10 +1619,11 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm *mvm,
 int iwl_mvm_wait_sta_queues_empty(struct iwl_mvm *mvm,
                                  struct iwl_mvm_sta *mvm_sta)
 {
-       int i, ret;
+       int i;
 
        for (i = 0; i < ARRAY_SIZE(mvm_sta->tid_data); i++) {
                u16 txq_id;
+               int ret;
 
                spin_lock_bh(&mvm_sta->lock);
                txq_id = mvm_sta->tid_data[i].txq_id;
@@ -1633,10 +1634,10 @@ int iwl_mvm_wait_sta_queues_empty(struct iwl_mvm *mvm,
 
                ret = iwl_trans_wait_txq_empty(mvm->trans, txq_id);
                if (ret)
-                       break;
+                       return ret;
        }
 
-       return ret;
+       return 0;
 }
 
 int iwl_mvm_rm_sta(struct iwl_mvm *mvm,