Blob Blame History Raw
From 853450a618022ea9e488a3f55f8826d1bb5a66bb Mon Sep 17 00:00:00 2001
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date: Sun, 30 Jan 2022 11:52:57 +0200
Subject: [PATCH] iwlwifi: mvm: use debug print instead of WARN_ON()
Git-commit: 853450a618022ea9e488a3f55f8826d1bb5a66bb
Patch-mainline: v5.18-rc1
References: bsc#1202131

In MCC_UPDATE_CMD we get from the FW the number of entries in the
channel info array. We used to WARN_ON if this parameter is greater
than we expected. Since this is not really a driver bug, and since it
might happen in some valid cases too, we shouldn't use a warning here.

Fix this by replacing the WARN_ON with a debug print.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220130115024.3cb9828df280.I14abe7c71b45bbae3d3cd503e6e13fa2cd372ed4@changeid
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index 895b0bc6fd5a..0693dfda43a3 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -1387,8 +1387,12 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
 		nvm_chan = iwl_nvm_channels;
 	}
 
-	if (WARN_ON(num_of_ch > max_num_ch))
+	if (num_of_ch > max_num_ch) {
+		IWL_DEBUG_DEV(dev, IWL_DL_LAR,
+			      "Num of channels (%d) is greater than expected. Truncating to %d\n",
+			      num_of_ch, max_num_ch);
 		num_of_ch = max_num_ch;
+	}
 
 	if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES))
 		return ERR_PTR(-EINVAL);
-- 
2.35.3