Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1093938pxj; Sat, 29 May 2021 03:02:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvpNXpUNwQFiMCXz6+Kxl43VhgwZWGbcHKidE8eQJ7d3t1vagWqKhRpxjDOATu3g8g+Mxl X-Received: by 2002:a05:6638:2181:: with SMTP id s1mr12336435jaj.66.1622282545217; Sat, 29 May 2021 03:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622282545; cv=none; d=google.com; s=arc-20160816; b=0LsUGZ3pfqR98moeTwh7lhVbIMuM6pUndmsIyqiHdovoWg4jPYwryWvHVrljQsHqw5 NQG9yGpEoLV6BO1xR3tUkAslbgiSyy0plH/gKGXsT8437TBAA9KLKj8F/QB94+rksqXj 9pXPyuEs7Oa8zIo3dd4TMdHPPF++09yj6OZlRIP6ZYqxKDYsmLkfvsS1bbNdsN7T0UqH Qw3gdfenUfPry7K30vEkuiSqX72qtSlF1QJlk8rKXPZ3DUm5s0CCbYI2mmJoOARmxaVy YcGuTpnKCgT8QyamvVgXu2s+ON5iMN5eg9DmZHizcieL8ehZbzLLlIiHBRvD4iKKSvlk DP9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3x8KD9tiZBovAACWYlPdJwi9QZYQFi+hgtkneaG2VEY=; b=U2nQ5ivTC4r1GmllFYKmO4kW1zNon/iyTrjhNPi7KEtgM7EHs23vYDw6vNJJhWAXL2 SCo3BsSYGpxKcmoo6o1xMGglypECm1PKoEWFT0emAVMdL3HHF/3qyZI9JSeiSrs1yULb uxawwd1tUdjP2P/s3U+amP0LC7TM8e4BiPhg493oG06LRZJKZpn7t4t/kXsYpKQMSoMH XzaTGWe9D67jyon7ANzAodzgey6QXi1PkIta1eCGg3V964K424W1asm1Ks1ZSTaVT4M+ ty9FJdtFizeo/9O1v+LKeQm4pE5FVMETsyH+ysk9jP23ixPhmrpeNytTEr3To/1w2QlY 6q0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aYSYjg5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si8305699ilg.26.2021.05.29.03.02.11; Sat, 29 May 2021 03:02:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aYSYjg5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbhE2KDT (ORCPT + 99 others); Sat, 29 May 2021 06:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbhE2KDT (ORCPT ); Sat, 29 May 2021 06:03:19 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED6F8C061574 for ; Sat, 29 May 2021 03:01:42 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id h3so3393013wmq.3 for ; Sat, 29 May 2021 03:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=3x8KD9tiZBovAACWYlPdJwi9QZYQFi+hgtkneaG2VEY=; b=aYSYjg5w1ecI5eyL+x11ihUXzitD0LYtRFFYf1s4ZBJIFxeHnD311zSKjYaQdUEwsd LDiWAC86B9rG0L/H7oHseEslqlzJa6Z/ci0YOlLRzU5XAZCDsn77OuIBLq4GZJskt67n wYT+s7qtVylQa4jDQE1dTAMcWd9gYydKP+SRHJGW8qOXCY0AsJFQvsseUOITUZIEfnVH nIGGVTeq1gfxlmC9d/ePjF9XgV9zMPC7e9r8ieVKl+Ccs1XfVolZzgutUx9WVSI2Lpct ieUv9ICNVHrU2TQWfv27Z8+lhjXCIuGq1nYft5BELPxsNMKSbKABOEnEGHOIuBpTxEC5 Aryw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=3x8KD9tiZBovAACWYlPdJwi9QZYQFi+hgtkneaG2VEY=; b=NlU/qfEBTCFOw3jak4nsicm0BY+pw4K/vu4vCFHs0SGzRx+KS6saShJ4a3G8HdSDbN JUS6I+o4PqcxDh0ZCo0VolaFzSXmSykElfKzHES5AKI5XbfhPemFMe1WTyN/kBlt2uOd H9AEOAw1PFT7LtndU1b/TDojSMnc3RUhdkVG1ZrEB4zOpWPnUauqFlMqmvHxo1arDOKt 0LmkUv4i7UETMEZZwcxQJ2lgkD9AkbI2MK7obgng1Ifo6R9+JvUDggvVTJOJhQ0UJ8w3 moWe/5NBaJFxOz44dmII2jPcXchWEFY8skvkczDBv1iVcrGz6ncf6fDAL6EC9p75CX3/ RDQQ== X-Gm-Message-State: AOAM532TMZyTVK0LzxMuZ0LrYU0Jb0IPINB9NnWZuWPCMu+ELYcQgxsf Hc0mCb/N6qOskaAVoZh7ZhQ= X-Received: by 2002:a1c:6004:: with SMTP id u4mr9382148wmb.110.1622282501441; Sat, 29 May 2021 03:01:41 -0700 (PDT) Received: from agape.jhs ([5.171.80.148]) by smtp.gmail.com with ESMTPSA id p6sm9207035wma.4.2021.05.29.03.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 03:01:41 -0700 (PDT) Date: Sat, 29 May 2021 12:01:38 +0200 From: Fabio Aiuto To: Yu Kuai Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, yi.zhang@huawei.com Subject: Re: [PATCH] staging: rtl8723bs: core: rtw_mlme_ext.c: move the declaration and initialization of 'evt_seq' inside ifdef macro Message-ID: <20210529100137.GA1416@agape.jhs> References: <20210529092948.3134775-1-yukuai3@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210529092948.3134775-1-yukuai3@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yu, On Sat, May 29, 2021 at 05:29:48PM +0800, Yu Kuai wrote: > 'evt_seq' is only used if 'CHECK_ENENT_SEQ' is defined, however, > it's declared and initialized even if 'CHECK_ENENT_SEQ' is not > defined. Thus gcc will report following warning if > 'CHECK_ENENT_SEQ' is not defined: the macro is mispelled in the commit description > > drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:6009:15: warning: > variable ‘evt_seq’ set but not used [-Wunused-but-set-variable] > 6009 | u8 evt_code, evt_seq; > > Thus move the declaration and initialization of 'evt_seq' inside > ifdef macro to fix it. > > Signed-off-by: Yu Kuai > --- > drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > index 97b3c2965770..e883371cc96d 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > @@ -6006,7 +6006,10 @@ static struct fwevent wlanevents[] = { > > u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) > { > - u8 evt_code, evt_seq; > +#ifdef CHECK_EVENT_SEQ > + u8 evt_seq; > +#endif > + u8 evt_code; > u16 evt_sz; > uint *peventbuf; > void (*event_callback)(struct adapter *dev, u8 *pbuf); > @@ -6017,18 +6020,17 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) > > peventbuf = (uint *)pbuf; > evt_sz = (u16)(*peventbuf&0xffff); > - evt_seq = (u8)((*peventbuf>>24)&0x7f); > evt_code = (u8)((*peventbuf>>16)&0xff); > > - > - #ifdef CHECK_EVENT_SEQ > +#ifdef CHECK_EVENT_SEQ > /* checking event sequence... */ > + evt_seq = (u8)((*peventbuf>>24)&0x7f); > if (evt_seq != (atomic_read(&pevt_priv->event_seq) & 0x7f)) { > pevt_priv->event_seq = (evt_seq+1)&0x7f; > > goto _abort_event_; > } > - #endif > +#endif > > /* checking if event code is valid */ > if (evt_code >= MAX_C2HEVT) > -- > 2.25.4 > > this conditional block seems to be dead code, for the symbolic constant CHECK_EVENT_SEQ is defined nowhere in the code. /staging$ grep -r CHECK_EVENT_SEQ . ./staging/rtl8723bs/core/rtw_mlme_ext.c: #ifdef CHECK_EVENT_SEQ so the variable can be safely removed together with the dead code block. thank you, fabio