diff mbox series

iwlwifi: fix false-positive maybe-uninitialized warning

Message ID 20181210203945.2147135-1-arnd@arndb.de (mailing list archive)
State Accepted
Delegated to: Luca Coelho
Headers show
Series iwlwifi: fix false-positive maybe-uninitialized warning | expand

Commit Message

Arnd Bergmann Dec. 10, 2018, 8:39 p.m. UTC
With CONFIG_NO_AUTO_INLINE, we run into a silly warning when
gcc fails to remember that n_profiles is constant across
the function call to iwl_mvm_sar_set_profile:

drivers/net/wireless/intel/iwlwifi/mvm/fw.c: In function 'iwl_mvm_sar_get_ewrd_table':
drivers/net/wireless/intel/iwlwifi/mvm/fw.c:746:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Marking that function 'inline' avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Luca Coelho Jan. 22, 2019, 10:50 a.m. UTC | #1
On Mon, 2018-12-10 at 21:39 +0100, Arnd Bergmann wrote:
> With CONFIG_NO_AUTO_INLINE, we run into a silly warning when
> gcc fails to remember that n_profiles is constant across
> the function call to iwl_mvm_sar_set_profile:
> 
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c: In function
> 'iwl_mvm_sar_get_ewrd_table':
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c:746:9: error: 'ret' may
> be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> Marking that function 'inline' avoids the warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Thanks! This has been applied in our internal tree and will reach the
mainline following our normal upstreaming process.

--
Cheers,
Luca.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index c5168abe107c..07676408146b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -629,10 +629,10 @@  static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
 }
 
 #ifdef CONFIG_ACPI
-static int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm,
-				   union acpi_object *table,
-				   struct iwl_mvm_sar_profile *profile,
-				   bool enabled)
+static inline int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm,
+					   union acpi_object *table,
+					   struct iwl_mvm_sar_profile *profile,
+					   bool enabled)
 {
 	int i;