linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 RESEND] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init()
@ 2025-04-22  2:32 Wentao Liang
  2025-04-22  7:34 ` Johannes Berg
  2025-04-22 12:22 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2025-04-22  2:32 UTC (permalink / raw)
  To: miriam.rachel.korenblit, kvalo
  Cc: johannes.berg, emmanuel.grumbach, golan.ben.ami, linux-wireless,
	linux-kernel, Wentao Liang

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 assist debugging by making the failure
visible in logs.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
v2: Fix improper code.

 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 7 ++++++-
 1 file changed, 6 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..34a7a3e4f7c0 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,11 @@ 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)
+			IWL_ERR(trans,
+				"NIC initialization failed after power-off (error %d).",
+				err);
 		iwl_op_mode_device_powered_off(trans->op_mode);
 	}
 
-- 
2.42.0.windows.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 RESEND] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init()
  2025-04-22  2:32 [PATCH v2 RESEND] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init() Wentao Liang
@ 2025-04-22  7:34 ` Johannes Berg
  2025-04-22 12:22 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2025-04-22  7:34 UTC (permalink / raw)
  To: Wentao Liang, miriam.rachel.korenblit, kvalo
  Cc: emmanuel.grumbach, golan.ben.ami, linux-wireless, linux-kernel

On Tue, 2025-04-22 at 10:32 +0800, Wentao Liang wrote:
> 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 assist debugging by making the failure
> visible in logs.
> 
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> v2: Fix improper code.
> 

Did you though? Especially before _resending_ (whilst a lot of the world
has holidays/vacations too...) you could check patchwork maybe?

Actually, just don't resend unless you see that it's no longer handled
in patchwork?

johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 RESEND] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init()
  2025-04-22  2:32 [PATCH v2 RESEND] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init() Wentao Liang
  2025-04-22  7:34 ` Johannes Berg
@ 2025-04-22 12:22 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-04-22 12:22 UTC (permalink / raw)
  To: Wentao Liang, miriam.rachel.korenblit, kvalo
  Cc: oe-kbuild-all, johannes.berg, emmanuel.grumbach, golan.ben.ami,
	linux-wireless, linux-kernel, Wentao Liang

Hi Wentao,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.15-rc3 next-20250417]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Wentao-Liang/wifi-iwlwifi-mvm-Add-error-logging-for-iwl_finish_nic_init/20250422-104110
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20250422023234.1992-1-vulab%40iscas.ac.cn
patch subject: [PATCH v2 RESEND] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init()
config: arm-randconfig-001-20250422 (https://download.01.org/0day-ci/archive/20250422/202504222012.DGGkXYWx-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250422/202504222012.DGGkXYWx-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504222012.DGGkXYWx-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from <command-line>:
   drivers/net/wireless/intel/iwlwifi/pcie/drv.c: In function '_iwl_pci_resume':
>> include/linux/compiler_types.h:557:38: error: call to '__compiletime_assert_671' declared with attribute error: BUILD_BUG_ON failed: "NIC initialization failed after power-off (error %d)."[sizeof("NIC initialization failed after power-off (error %d).") - 2] != '\n'
     _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
                                         ^
   include/linux/compiler_types.h:538:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler_types.h:557:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/iwl-debug.h:40:30: note: in expansion of macro 'BUILD_BUG_ON'
    #define CHECK_FOR_NEWLINE(f) BUILD_BUG_ON(f[sizeof(f) - 2] != '\n')
                                 ^~~~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/iwl-debug.h:45:3: note: in expansion of macro 'CHECK_FOR_NEWLINE'
      CHECK_FOR_NEWLINE(f);     \
      ^~~~~~~~~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/iwl-debug.h:49:2: note: in expansion of macro '__IWL_ERR_DEV'
     __IWL_ERR_DEV(d, IWL_ERR_MODE_REGULAR, f, ## a)
     ^~~~~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/iwl-debug.h:51:2: note: in expansion of macro 'IWL_ERR_DEV'
     IWL_ERR_DEV((m)->dev, f, ## a)
     ^~~~~~~~~~~
   drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1777:4: note: in expansion of macro 'IWL_ERR'
       IWL_ERR(trans,
       ^~~~~~~
--
   In file included from <command-line>:
   pcie/drv.c: In function '_iwl_pci_resume':
>> include/linux/compiler_types.h:557:38: error: call to '__compiletime_assert_671' declared with attribute error: BUILD_BUG_ON failed: "NIC initialization failed after power-off (error %d)."[sizeof("NIC initialization failed after power-off (error %d).") - 2] != '\n'
     _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
                                         ^
   include/linux/compiler_types.h:538:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler_types.h:557:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
   ././iwl-debug.h:40:30: note: in expansion of macro 'BUILD_BUG_ON'
    #define CHECK_FOR_NEWLINE(f) BUILD_BUG_ON(f[sizeof(f) - 2] != '\n')
                                 ^~~~~~~~~~~~
   ././iwl-debug.h:45:3: note: in expansion of macro 'CHECK_FOR_NEWLINE'
      CHECK_FOR_NEWLINE(f);     \
      ^~~~~~~~~~~~~~~~~
   ././iwl-debug.h:49:2: note: in expansion of macro '__IWL_ERR_DEV'
     __IWL_ERR_DEV(d, IWL_ERR_MODE_REGULAR, f, ## a)
     ^~~~~~~~~~~~~
   ././iwl-debug.h:51:2: note: in expansion of macro 'IWL_ERR_DEV'
     IWL_ERR_DEV((m)->dev, f, ## a)
     ^~~~~~~~~~~
   pcie/drv.c:1777:4: note: in expansion of macro 'IWL_ERR'
       IWL_ERR(trans,
       ^~~~~~~


vim +557 include/linux/compiler_types.h

eb5c2d4b45e3d2d Will Deacon 2020-07-21  543  
eb5c2d4b45e3d2d Will Deacon 2020-07-21  544  #define _compiletime_assert(condition, msg, prefix, suffix) \
eb5c2d4b45e3d2d Will Deacon 2020-07-21  545  	__compiletime_assert(condition, msg, prefix, suffix)
eb5c2d4b45e3d2d Will Deacon 2020-07-21  546  
eb5c2d4b45e3d2d Will Deacon 2020-07-21  547  /**
eb5c2d4b45e3d2d Will Deacon 2020-07-21  548   * compiletime_assert - break build and emit msg if condition is false
eb5c2d4b45e3d2d Will Deacon 2020-07-21  549   * @condition: a compile-time constant condition to check
eb5c2d4b45e3d2d Will Deacon 2020-07-21  550   * @msg:       a message to emit if condition is false
eb5c2d4b45e3d2d Will Deacon 2020-07-21  551   *
eb5c2d4b45e3d2d Will Deacon 2020-07-21  552   * In tradition of POSIX assert, this macro will break the build if the
eb5c2d4b45e3d2d Will Deacon 2020-07-21  553   * supplied condition is *false*, emitting the supplied error message if the
eb5c2d4b45e3d2d Will Deacon 2020-07-21  554   * compiler has support to do so.
eb5c2d4b45e3d2d Will Deacon 2020-07-21  555   */
eb5c2d4b45e3d2d Will Deacon 2020-07-21  556  #define compiletime_assert(condition, msg) \
eb5c2d4b45e3d2d Will Deacon 2020-07-21 @557  	_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
eb5c2d4b45e3d2d Will Deacon 2020-07-21  558  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-22 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22  2:32 [PATCH v2 RESEND] wifi: iwlwifi: mvm: Add error logging for iwl_finish_nic_init() Wentao Liang
2025-04-22  7:34 ` Johannes Berg
2025-04-22 12:22 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).