iwlwifi: mvm: bail out if CTDP start operation fails
authorLuca Coelho <luciano.coelho@intel.com>
Wed, 14 Sep 2016 08:54:36 +0000 (11:54 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 22 Sep 2016 20:25:36 +0000 (23:25 +0300)
We were assigning the return value of iwl_mvm_ctdp_command() to a
variable, but never checking it.  If this command fails, we should not
allow the interface up process to proceed, since it is potentially
dangerous to ignore thermal management requirements.

Fixes: commit 5c89e7bc557e ("iwlwifi: mvm: add registration to cooling device")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index 8f10780808f6c8502089383e54d432d2dd90a48b..897412057d1fd9b5865bc05f9ffc4ca8d7f1d5ad 100644 (file)
@@ -1233,9 +1233,12 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
        }
 
        /* TODO: read the budget from BIOS / Platform NVM */
-       if (iwl_mvm_is_ctdp_supported(mvm) && mvm->cooling_dev.cur_state > 0)
+       if (iwl_mvm_is_ctdp_supported(mvm) && mvm->cooling_dev.cur_state > 0) {
                ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START,
                                           mvm->cooling_dev.cur_state);
+               if (ret)
+                       goto error;
+       }
 #else
        /* Initialize tx backoffs to the minimal possible */
        iwl_mvm_tt_tx_backoff(mvm, 0);