Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1074755pxj; Sat, 29 May 2021 02:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5gVHN3s0pXlLy4vMgFzTcS8x7Iz6UGQ5dk1cPFQEEikH6mfz0dqUF8SlwIBMV3VAFGudE X-Received: by 2002:a05:6e02:e05:: with SMTP id a5mr10057837ilk.235.1622280104440; Sat, 29 May 2021 02:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622280104; cv=none; d=google.com; s=arc-20160816; b=zVlfEhqr4EH4gVsvAUGNzuzLPRKVjHsFm2wcOcZHbH6sZBze6rtDd6IqfV0jfYkiZz sPEweycCJBD1oSrHJJXWuD+RVuNanDKHEpZRCmAjLm/Ki/l/XSXXfsyzSpHOEMiz3tUi 9yPtq2vsKLuQtdPC8Uxuf8/o0RMCqcstH+2cGlFOhvyYKK6+LExRrm+dIwoFvDlmDN6e aLg8Jbyc4+hni//QDQEqEiG/6SExaluq8Crc93m3pz0tA25p+D2xY7JXFcEmC3M4IYq/ T2r1/vZ9ry4PgXLWzNok4eQFwCTiInbYYzbLfNbEP8fyXeG97pLFfoUSv7yZGlZgRA74 ERjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8n4FM/eqzRiDRoHiNk7OlxEQEZHzgp1LdR8wpb/bUr0=; b=MZytlUuChjR5RIqXwh4IMerRqU6z2TjasRkDkkL3IKN52mkwM9VwCl/KWev4DiJFdi aKRwiipb+wHXfTCs40umYadFlKRAVa7MLvkTiwEfRoVyichC4Bw7C1PZuS51wGl8CWc0 e3VnZXfl9JPIeRKQyJG8tM8e45iy1E2jXElB8wpYEBqzDElT6G9VRQA57AH2G5ZeDRI/ MNi4fpiOCfpTNNK//JtHMBGNkd5uEMd8F1eRIt1gS9hyYS1OxzBDuXZaG9pk/4uGOkqY 57a4iPTppbESwi4Pw+1wd8buTji3DkqL4jLU6Ek2b+YKFu2dV+Zrb8MZuH7W6fAMr1Uk baVw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si7104648iow.13.2021.05.29.02.21.30; Sat, 29 May 2021 02:21:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbhE2JWE (ORCPT + 99 others); Sat, 29 May 2021 05:22:04 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2094 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbhE2JWE (ORCPT ); Sat, 29 May 2021 05:22:04 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FsbWS6d96zWpSZ; Sat, 29 May 2021 17:15:48 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sat, 29 May 2021 17:20:26 +0800 Received: from huawei.com (10.175.127.227) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Sat, 29 May 2021 17:20:26 +0800 From: Yu Kuai To: CC: , , , Subject: [PATCH] staging: rtl8723bs: core: rtw_mlme_ext.c: move the declaration and initialization of 'evt_seq' inside ifdef macro Date: Sat, 29 May 2021 17:29:48 +0800 Message-ID: <20210529092948.3134775-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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: 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