> -----Original Message----- > From: Lukas Wunner <lukas@xxxxxxxxx> > Sent: Sunday, 6 April 2025 16:44 > To: Korenblit, Miriam Rachel <miriam.rachel.korenblit@xxxxxxxxx>; Berg, > Johannes <johannes.berg@xxxxxxxxx>; Grumbach, Emmanuel > <emmanuel.grumbach@xxxxxxxxx>; Berg, Benjamin <benjamin.berg@xxxxxxxxx>; > Ben Shimol, Yedidya <yedidya.ben.shimol@xxxxxxxxx>; Arnd Bergmann > <arnd@xxxxxxxx>; Stern, Avraham <avraham.stern@xxxxxxxxx>; Gabay, Daniel > <daniel.gabay@xxxxxxxxx>; Anjaneyulu, Pagadala Yesu > <pagadala.yesu.anjaneyulu@xxxxxxxxx>; Triebitz, Shaul > <shaul.triebitz@xxxxxxxxx> > Cc: linux-wireless@xxxxxxxxxxxxxxx > Subject: [PATCH v2] wifi: iwlwifi: mld: fix building with CONFIG_PM_SLEEP > disabled > > From: Arnd Bergmann <arnd@xxxxxxxx> > > The newly added driver causes multiple build problems when CONFIG_PM_SLEEP > is disabled: > > drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1982:12: error: > 'iwl_mld_resume' defined but not used [-Werror=unused-function] > 1982 | static int iwl_mld_resume(struct ieee80211_hw *hw) > | ^~~~~~~~~~~~~~ > drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1960:1: error: > 'iwl_mld_suspend' defined but not used [-Werror=unused-function] > 1960 | iwl_mld_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan > *wowlan) > | ^~~~~~~~~~~~~~~ > drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1946:13: error: > 'iwl_mld_set_wakeup' defined but not used [-Werror=unused-function] > 1946 | static void iwl_mld_set_wakeup(struct ieee80211_hw *hw, bool enabled) > | ^~~~~~~~~~~~~~~~~~ > drivers/net/wireless/intel/iwlwifi/mld/mac80211.c: In function > 'iwl_mld_mac80211_start': > drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:504:20: error: 'ret' is used > uninitialized [-Werror=uninitialized] > 504 | if (!in_d3 || ret) { > | ^~ > drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:478:13: note: 'ret' was > declared here > 478 | int ret; > | ^~~ > > Hide the unused functions and make sure the 'ret' variable is initialized before > being used. > > Fixes: d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver") > Reported-by: kernel test robot <lkp@xxxxxxxxx> > Closes: https://lore.kernel.org/r/202504032255.N6ptuCNG-lkp@xxxxxxxxx/ > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> > [lukas: initialize ret to 0, use static inline] > Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx> > --- > Changes v1 -> v2: > Initialize ret to 0 instead of removing it from the if-clause (Miriam). > Use static inline for iwl_mld_no_wowlan_suspend() instead of an #ifdef in > accordance with section 21 of Documentation/process/coding-style.rst. > > Link to v1: > https://lore.kernel.org/r/20250325084340.378724-1-arnd@xxxxxxxxxx/ > > drivers/net/wireless/intel/iwlwifi/mld/d3.h | 4 ++++ > drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 4 +++- > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/mld/d3.h > b/drivers/net/wireless/intel/iwlwifi/mld/d3.h > index 618d6fb..4157f82 100644 > --- a/drivers/net/wireless/intel/iwlwifi/mld/d3.h > +++ b/drivers/net/wireless/intel/iwlwifi/mld/d3.h > @@ -34,6 +34,7 @@ struct iwl_mld_wowlan_data { > struct iwl_mld_rekey_data rekey_data; > }; > > +#ifdef CONFIG_PM_SLEEP > int iwl_mld_no_wowlan_resume(struct iwl_mld *mld); int > iwl_mld_no_wowlan_suspend(struct iwl_mld *mld); int > iwl_mld_wowlan_suspend(struct iwl_mld *mld, @@ -47,5 +48,8 @@ void > iwl_mld_ipv6_addr_change(struct ieee80211_hw *hw, > struct ieee80211_vif *vif, > struct inet6_dev *idev); > #endif > +#else > +static inline int iwl_mld_no_wowlan_suspend(struct iwl_mld *mld) { > +return 0; You are not supposed to get to this function not under the ifdef. So if you do, I'd return an error value, not 0? } #endif > > #endif /* __iwl_mld_d3_h__ */ > diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c > b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c > index 6851064..18cd607 100644 > --- a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c > +++ b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c > @@ -475,8 +475,8 @@ int iwl_mld_register_hw(struct iwl_mld *mld) int > iwl_mld_mac80211_start(struct ieee80211_hw *hw) { > struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw); > - int ret; > bool in_d3 = false; > + int ret = 0; > > lockdep_assert_wiphy(mld->wiphy); > > @@ -1943,6 +1943,7 @@ static void iwl_mld_sta_rc_update(struct > ieee80211_hw *hw, > } > } > > +#ifdef CONFIG_PM_SLEEP > static void iwl_mld_set_wakeup(struct ieee80211_hw *hw, bool enabled) { > struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw); @@ -1994,6 > +1995,7 @@ static int iwl_mld_resume(struct ieee80211_hw *hw) > > return 0; > } > +#endif > > static int iwl_mld_alloc_ptk_pn(struct iwl_mld *mld, > struct iwl_mld_sta *mld_sta, > -- > 2.43.0 >