iwlwifi: mvm: don't send CTDP commands via debugfs if not supported
authorMatt Chen <matt.chen@intel.com>
Fri, 23 Jun 2017 09:50:18 +0000 (17:50 +0800)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Aug 2017 18:14:42 +0000 (21:14 +0300)
Fix this issue if it is not supported by the firmware.

Fixes: 00f481bd895a ("iwlwifi: mvm: add ctdp operations to debugfs")
Signed-off-by: Matt Chen <matt.chen@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c

index 0b5cae54b86b2cb2196ab1eb0f6e41ef5010764c..ceb486610a56dacd0044eefa1322e243dd5ad9a6 100644 (file)
@@ -82,6 +82,9 @@ static ssize_t iwl_dbgfs_ctdp_budget_read(struct file *file,
        char buf[16];
        int pos, budget;
 
+       if (!iwl_mvm_is_ctdp_supported(mvm))
+               return -EOPNOTSUPP;
+
        if (!iwl_mvm_firmware_running(mvm) ||
            mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
                return -EIO;
@@ -103,6 +106,9 @@ static ssize_t iwl_dbgfs_stop_ctdp_write(struct iwl_mvm *mvm, char *buf,
 {
        int ret;
 
+       if (!iwl_mvm_is_ctdp_supported(mvm))
+               return -EOPNOTSUPP;
+
        if (!iwl_mvm_firmware_running(mvm) ||
            mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
                return -EIO;