From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pf0-f181.google.com ([209.85.192.181]:35241 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751765AbdGFRL4 (ORCPT ); Thu, 6 Jul 2017 13:11:56 -0400 Received: by mail-pf0-f181.google.com with SMTP id c73so3959099pfk.2 for ; Thu, 06 Jul 2017 10:11:56 -0700 (PDT) Date: Thu, 6 Jul 2017 10:11:53 -0700 From: Brian Norris To: Shawn Lin Cc: Amitkumar Karwar , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Nishant Sarmukadam , Xinming Hu Subject: Re: [PATCH] mwifiex: fix compile warning of unused variable Message-ID: <20170706171152.GA120202@google.com> (sfid-20170706_191203_279299_11D9A475) References: <1499327433-70786-1-git-send-email-shawn.lin@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1499327433-70786-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: On Thu, Jul 06, 2017 at 03:50:33PM +0800, Shawn Lin wrote: > We got a compile warning shows below: > > drivers/net/wireless/marvell/mwifiex/sdio.c: In function > 'mwifiex_sdio_remove': > drivers/net/wireless/marvell/mwifiex/sdio.c:377:6: warning: variable > 'ret' set but not used [-Wunused-but-set-variable] It's probably worth noting that this is not a default warning [1], especially if you resend. It already confused Kalle. [1] In Makefile: # These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) > Per the code, it didn't check if mwifiex_sdio_read_fw_status > finish successfully. We should at least check the return of > mwifiex_sdio_read_fw_status, otherwise the following check of > firmware_stat and adapter->mfg_mode is pointless as the device > is probably dead. > > Signed-off-by: Shawn Lin > --- > > drivers/net/wireless/marvell/mwifiex/sdio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c > index f81a006..fd5183c 100644 > --- a/drivers/net/wireless/marvell/mwifiex/sdio.c > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c > @@ -390,7 +390,8 @@ static int mwifiex_check_winner_status(struct mwifiex_adapter *adapter) > mwifiex_dbg(adapter, INFO, "info: SDIO func num=%d\n", func->num); > > ret = mwifiex_sdio_read_fw_status(adapter, &firmware_stat); > - if (firmware_stat == FIRMWARE_READY_SDIO && !adapter->mfg_mode) { > + if (!ret && firmware_stat == FIRMWARE_READY_SDIO && > + !adapter->mfg_mode) { The PCIe driver has the same code structure. Might change both, if you're changing one of them? The PCIe one is technically safe I guess, since it will write to the 'firmware_stat' variable regardless of success or failure, whereas this SDIO one will not. But it would keep things clear and obvious. With (or without) that change: Reviewed-by: Brian Norris Brian > mwifiex_deauthenticate_all(adapter); > > priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); > -- > 1.9.1 > >