Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1409362

Re: [PATCH] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning

From "Coelho, Luciano" <luciano.coelho@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning
Date 2016-05-30 22:40 +0200
Message-ID <rEC8F-Os-3@gated-at.bofh.it> (permalink)
References <rDpGy-3QJ-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2016-05-27 at 15:07 +0200, Arnd Bergmann wrote:
> gcc is apparently unablel to track the state of the local 'resp_v2'
> variable across the kzalloc() function, and warns about the response
> variable being used without an initialization:
> 
> drivers/net/wireless/intel/iwlwifi/mvm/nvm.c: In function
> ‘iwl_mvm_update_mcc’:
> drivers/net/wireless/intel/iwlwifi/mvm/nvm.c:727:36: warning:
> ‘mcc_resp_v1’ may be used uninitialized in this function [-Wmaybe-
> uninitialized]
>    resp_cp->n_channels = mcc_resp_v1->n_channels;
> drivers/net/wireless/intel/iwlwifi/mvm/nvm.c:721:3: warning:
> ‘mcc_resp’ may be used uninitialized in this function [-Wmaybe-
> uninitialized]
>    memcpy(resp_cp, mcc_resp, resp_len);
> 
> The warning showed up in x86 allmodconfig after my patch to
> unhide -Wmaybe-uninitialized warnings by default was merged,
> though it always existed in randconfig builds. I did not
> catch the warning earlier because I was testing on ARM, which
> never produced the warning.
> 
> This rearranges the code in a way that improves readability for
> both humans and the compiler, and that avoids the warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 6fa52430f0b3 ("iwlwifi: mvm: change mcc update API")
> ---

Thanks, Arnd! I queued this via our internal tree.

--
Cheers,
Luca.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning Arnd Bergmann <arnd@arndb.de> - 2016-05-27 15:10 +0200
  Re: [PATCH] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning "Coelho, Luciano" <luciano.coelho@intel.com> - 2016-05-30 22:40 +0200

csiph-web