]> git.baikalelectronics.ru Git - kernel.git/commit
iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 27 May 2016 13:07:03 +0000 (15:07 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 5 Jul 2016 22:19:54 +0000 (01:19 +0300)
commitd7cb6fd8b302235d66c6909e6a5e3b3de12001be
treebcc2cc0c7ef2d7e16d2a2540e1ab9cb8afab42de
parent1de4f3b1754371d65196dce4538f1217a5fbd4aa
iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning

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: b398bfbde36b ("iwlwifi: mvm: change mcc update API")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c