diff mbox series

wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init()

Message ID 20250406164206.1120-1-vulab@iscas.ac.cn (mailing list archive)
State New
Delegated to: Miri Korenblit
Headers show
Series wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init() | expand

Checks

Context Check Description
wifibot/fixes_present success Fixes tag not required for -next series
wifibot/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
wifibot/tree_selection success Guessed tree name to be wireless-next
wifibot/ynl success Generated files up to date; no warnings/errors; no diff in generated;
wifibot/build_32bit success Errors and warnings before: 0 this patch: 0
wifibot/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
wifibot/build_clang success Errors and warnings before: 0 this patch: 0
wifibot/build_clang_rust success No Rust files in patch. Skipping build
wifibot/build_tools success No tools touched, skip
wifibot/check_selftest success No net selftest shell script
wifibot/checkpatch warning WARNING: line length of 93 exceeds 80 columns
wifibot/deprecated_api success None detected
wifibot/header_inline success No static functions without inline keyword in header files
wifibot/kdoc success Errors and warnings before: 0 this patch: 0
wifibot/source_inline success Was 0 now: 0
wifibot/verify_fixes success No Fixes tag
wifibot/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

Wentao Liang April 6, 2025, 4:42 p.m. UTC
The function iwl_pci_resume() calls the function iwl_finish_nic_init(),
but does not check their return values.

Log a detailed error message with the error code to aid in diagnosing
root causes if encountering irreparable errors. While this does not fix
the underlying problem, it avoids silent failures by making the failure
visible in logs.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Korenblit, Miriam Rachel April 7, 2025, 6:47 a.m. UTC | #1
> -----Original Message-----
> From: Wentao Liang <vulab@iscas.ac.cn>
> Sent: Sunday, 6 April 2025 19:42
> To: Korenblit, Miriam Rachel <miriam.rachel.korenblit@intel.com>;
> kvalo@kernel.org
> Cc: Berg, Johannes <johannes.berg@intel.com>; Grumbach, Emmanuel
> <emmanuel.grumbach@intel.com>; Ben Ami, Golan <golan.ben.ami@intel.com>;
> linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org; Wentao Liang
> <vulab@iscas.ac.cn>
> Subject: [PATCH] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init()
> 
> The function iwl_pci_resume() calls the function iwl_finish_nic_init(), but does not
> check their return values.
> 
> Log a detailed error message with the error code to aid in diagnosing root causes
> if encountering irreparable errors. While this does not fix the underlying problem,
> it avoids silent failures by making the failure visible in logs.
> 
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> index 8fb2aa282242..f577f8c1d5b0 100644
> --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> @@ -1616,6 +1616,7 @@ static int _iwl_pci_resume(struct device *device, bool
> restore)
>  	struct iwl_trans *trans = pci_get_drvdata(pdev);
>  	struct iwl_trans_pcie *trans_pcie =
> IWL_TRANS_GET_PCIE_TRANS(trans);
>  	bool device_was_powered_off = false;
> +	int err;
> 
>  	/* Before you put code here, think about WoWLAN. You cannot check
> here
>  	 * whether WoWLAN is enabled or not, and your code will run even if
> @@ -1647,7 +1648,9 @@ static int _iwl_pci_resume(struct device *device, bool
> restore)
>  		 * won't really know how to recover.
>  		 */
>  		iwl_pcie_prepare_card_hw(trans);
> -		iwl_finish_nic_init(trans);
> +		err = iwl_finish_nic_init(trans);
> +		if (err)
> +			pr_err("NIC initialization failed after power-off (error
> %d).",
> +err);
>  		iwl_op_mode_device_powered_off(trans->op_mode);
>  	}
> 
> --
> 2.42.0.windows.2
iwl_finish_nic_init has a print inside when it fails. You can enable that debug level
while it can be a good idea to have that log as a 'IWL_ERR'.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 8fb2aa282242..f577f8c1d5b0 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1616,6 +1616,7 @@  static int _iwl_pci_resume(struct device *device, bool restore)
 	struct iwl_trans *trans = pci_get_drvdata(pdev);
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	bool device_was_powered_off = false;
+	int err;
 
 	/* Before you put code here, think about WoWLAN. You cannot check here
 	 * whether WoWLAN is enabled or not, and your code will run even if
@@ -1647,7 +1648,9 @@  static int _iwl_pci_resume(struct device *device, bool restore)
 		 * won't really know how to recover.
 		 */
 		iwl_pcie_prepare_card_hw(trans);
-		iwl_finish_nic_init(trans);
+		err = iwl_finish_nic_init(trans);
+		if (err)
+			pr_err("NIC initialization failed after power-off (error %d).", err);
 		iwl_op_mode_device_powered_off(trans->op_mode);
 	}