From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755203AbcE3UhO (ORCPT ); Mon, 30 May 2016 16:37:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:28103 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752176AbcE3UhK (ORCPT ); Mon, 30 May 2016 16:37:10 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,391,1459839600"; d="scan'208";a="113034060" From: "Coelho, Luciano" To: "Gottlieb, Matti" , "arnd@arndb.de" , "Grumbach, Emmanuel" CC: "linux-kernel@vger.kernel.org" , linuxwifi , "torvalds@linux-foundation.org" , "Harel, Moshe" , "Berg, Johannes" , "kvalo@codeaurora.org" , "netdev@vger.kernel.org" , "linux-wireless@vger.kernel.org" Subject: Re: [PATCH] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning Thread-Topic: [PATCH] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning Thread-Index: AQHRuBjWq6N6ElrZCkSGyZzBZdqKs5/R5RUA Date: Mon, 30 May 2016 20:37:02 +0000 Message-ID: <1464640622.19317.54.camel@intel.com> References: <1464354462-1940949-1-git-send-email-arnd@arndb.de> In-Reply-To: <1464354462-1940949-1-git-send-email-arnd@arndb.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.252.31.148] Content-Type: text/plain; charset="utf-8" Content-ID: <13CC8AB7B6DAAE4297FE3E682CC24901@intel.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u4UKbINm028647 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 > Fixes: 6fa52430f0b3 ("iwlwifi: mvm: change mcc update API") > --- Thanks, Arnd! I queued this via our internal tree. -- Cheers, Luca.