Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3377150rwb; Sun, 9 Oct 2022 04:12:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6P85vGPPnLgjTmInQkmY97RR4IxAqRnwpnVwNbMJbtMf7gWduOCGhmdKTKvtxOtZoqliGg X-Received: by 2002:a05:6402:292f:b0:458:e447:5c with SMTP id ee47-20020a056402292f00b00458e447005cmr12469741edb.286.1665313925237; Sun, 09 Oct 2022 04:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665313925; cv=none; d=google.com; s=arc-20160816; b=MGNN2Ur6Eyq+4aeQvcqpFNBM88vF1bpLpFyqgnpwXv7RxXEn5x2HW6yRADyHVQ/iLs SdJCWimgHO+KW1S5kuxyWcDoL+LCxgfmbYIeSzZcrHjnp21cXfz8vYWf9tehCI/PQN5r o4sGGXamqxRDL/3f427FpadidWmqRcGZfpmKXah+t6FfY7eGt0x0bZxLwUgW0zSU34c3 FrNlNvDOoUmeGooej48QLm09KoxwcQh2Chce4yZP3bYVB1k9Dx9g678MlsgwKXlm3l1J uO990ytZ3yquGKzDbjxLB8pXBJFUuiQkQ9b3KY5LCnzb0niDJ4qBIJjQCQEyrNRjlGFQ EBnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=s0rE7etBQe+nz+BcaLC9SpN/VJmDM+ocvjRE0YfSpgM=; b=pG48k4TnrWCwzJH++Lc6s4TJ1Tu6rQyeQ8wXOjxCZ8un6f4KrzRhsl+5C9HbNz2iVd HYFmX0FmNSjQRm7HLCZRPhHyJo4MP4PBFaVwT8SzOH3bvmhImdLAgaLqH9h0ULmaIIUy JWm4xH+FZg+a01KDF1ARcetbbBIpfjdNTnXQYqEMQwp21AqvRvCd8nwIhOvOmuMNFl8v VzjMseSEEGEeKfi9gw8y7+kWFoIvEFaL0uH/c4I24znN8qzhwzIom66P9gkFWGUoy4Pl 8AQyOHOb8XBQJrjJmjPyXFYqty5HMKA18CXz8SGE6YjsS9u8xEIwNA2r8ocwItpV4qgz jFRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mG7AtKN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k26-20020aa7d8da000000b00459121f32e0si3769691eds.619.2022.10.09.04.11.38; Sun, 09 Oct 2022 04:12:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mG7AtKN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230038AbiJIKxx (ORCPT + 99 others); Sun, 9 Oct 2022 06:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbiJIKxv (ORCPT ); Sun, 9 Oct 2022 06:53:51 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DFBF24951 for ; Sun, 9 Oct 2022 03:53:50 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id qw20so19014944ejc.8 for ; Sun, 09 Oct 2022 03:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=s0rE7etBQe+nz+BcaLC9SpN/VJmDM+ocvjRE0YfSpgM=; b=mG7AtKN8kTDNlIaaPxDrwreyU78jgaDiH2hxOeS5C0yQOad1OuGpCYrNZmRppFwBVe +hNQhzM/zp62WddJHXIEg7kHBjgO92PhylqJxCnNN90wa6gvdZcxCuA5R5TAnavd1ghL x6s+cb1LQ1SZ2K3qZyPxVle5+X6jUVgzRDWuQz8tOisSaRg+MbTtsYQLjq1yNGIkeeyY wDWRm+mhf6DifjFYpDeIR/46REtLrGPQMv+7zWxby1wn8q/etXWQ/eD2xUY63okH7Zs2 HtPYR1xyt8fPTYqxGh7cugxZm127FvByR5dxfLpn6EUs+GxX3IoGPW9Q0pVwmKLTSaxE BaIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=s0rE7etBQe+nz+BcaLC9SpN/VJmDM+ocvjRE0YfSpgM=; b=Sn1Uab860UyepI/UHeVTLl5dTpDPbF1LIX4VuKVfp74amBPDwvxmLL5PArx8VdOMGj 9/Ab32/KxAagIpUPIQA+VfKnAYXOFYlNxBO3iVU+5NBHal3c291Z8W6qlTEr4AJf38yi 93fxQqIksIQd6Al2giakPWaxc2iTVFzeQ7m78zYjgR6vylTm5UF8TRwJ3668AAO29XsZ xKhfuMqFOhMdQSDwWtckozz6do5uB8UCDA8rXA8NqxdcPyQRLFC1Qjs3m63VmSeBplGN h7McIN+l0kJcMxrr2ZukpEKR2kgvE6s6qY/4zBpVfKv/cQgnBATzJFoORSK5yctc2QHj 53HQ== X-Gm-Message-State: ACrzQf0HHLM48Bz/212DzTQ+rbrTpGhmixkayeDgdQdf45uxqSz73ayf JmeHAmqCHWEy8vN4xUHA7xo= X-Received: by 2002:a17:906:5a6d:b0:78d:a139:669b with SMTP id my45-20020a1709065a6d00b0078da139669bmr2943100ejc.581.1665312828767; Sun, 09 Oct 2022 03:53:48 -0700 (PDT) Received: from nam-dell (ip-217-105-46-158.ip.prioritytelecom.net. [217.105.46.158]) by smtp.gmail.com with ESMTPSA id lo25-20020a170906fa1900b007306a4ecc9dsm3873037ejb.18.2022.10.09.03.53.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Oct 2022 03:53:48 -0700 (PDT) Date: Sun, 9 Oct 2022 12:53:40 +0200 From: Nam Cao To: Rui Li Cc: Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8192e: Fix braces/tabs/number/OOM warnings Message-ID: <20221009105340.GA52150@nam-dell> References: <166528776854.9.8249842126243786800.67724771@lirui.org> <20221009104644.GA49790@nam-dell> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221009104644.GA49790@nam-dell> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 09, 2022 at 12:46:44PM +0200, Nam Cao wrote: > On Sun, Oct 09, 2022 at 11:55:36AM +0800, Rui Li wrote: > > Fix warnings generated by checkpatch.pl: unnecessary braces after > > if, too many leading tabs, int type conversion before number, > > OOM message ourput. > > > > Signed-off-by: Rui Li > > --- > > .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 3 +- > > .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 9 ++---- > > drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 -- > > drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 30 +++++++------------ > > drivers/staging/rtl8192e/rtl819x_BAProc.c | 5 ++-- > > drivers/staging/rtl8192e/rtl819x_HTProc.c | 1 + > > drivers/staging/rtl8192e/rtllib_rx.c | 8 ++--- > > drivers/staging/rtl8192e/rtllib_softmac_wx.c | 7 ++--- > > 8 files changed, 25 insertions(+), 41 deletions(-) > > > > diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c > > index 18e4e5d84878..8d20b0deca37 100644 > > --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c > > +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c > > @@ -1112,9 +1112,8 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, > > if (cb_desc->bHwSec) { > > static u8 tmp; > > > > - if (!tmp) { > > + if (!tmp) > > tmp = 1; > > - } > > switch (priv->rtllib->pairwise_key_type) { > > case KEY_TYPE_WEP40: > > case KEY_TYPE_WEP104: > > diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c > > index 1b592258e640..4e3d183be0f2 100644 > > --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c > > +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c > > @@ -522,9 +522,8 @@ static bool _rtl92e_bb_config_para_file(struct net_device *dev) > > rtStatus = rtl92e_check_bb_and_rf(dev, > > (enum hw90_block)eCheckItem, > > (enum rf90_radio_path)0); > > - if (!rtStatus) { > > + if (!rtStatus) > > return rtStatus; > > - } > > } > > rtl92e_set_bb_reg(dev, rFPGA0_RFMOD, bCCKEn|bOFDMEn, 0x0); > > _rtl92e_phy_config_bb(dev, BaseBand_Config_PHY_REG); > > @@ -1379,9 +1378,8 @@ static bool _rtl92e_set_rf_power_state(struct net_device *dev, > > i++; > > } > > > > - if (i >= MAX_DOZE_WAITING_TIMES_9x) { > > + if (i >= MAX_DOZE_WAITING_TIMES_9x) > > break; > > - } > > } > > rtl92e_set_rf_off(dev); > > break; > > @@ -1398,9 +1396,8 @@ static bool _rtl92e_set_rf_power_state(struct net_device *dev, > > i++; > > } > > > > - if (i >= MAX_DOZE_WAITING_TIMES_9x) { > > + if (i >= MAX_DOZE_WAITING_TIMES_9x) > > break; > > - } > > } > > > > if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC && > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c > > index 89bc989cffba..b2facb273474 100644 > > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c > > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c > > @@ -908,9 +908,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) > > priv->card_type = PCI; > > > > priv->pFirmware = vzalloc(sizeof(struct rt_firmware)); > > - if (!priv->pFirmware) > > - netdev_err(dev, > > - "rtl8192e: Unable to allocate space for firmware\n"); > > > > skb_queue_head_init(&priv->skb_queue); > > > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > > index 702551056227..32494ad2298b 100644 > > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > > @@ -267,9 +267,8 @@ static void _rtl92e_dm_check_ac_dc_power(struct net_device *dev) > > "PATH=/usr/bin:/bin", > > NULL}; > > > > - if (priv->ResetProgress == RESET_TYPE_SILENT) { > > + if (priv->ResetProgress == RESET_TYPE_SILENT) > > return; > > - } > > > > if (priv->rtllib->state != RTLLIB_LINKED) > > return; > > @@ -330,9 +329,8 @@ static void _rtl92e_dm_check_rate_adaptive(struct net_device *dev) > > bool bshort_gi_enabled = false; > > static u8 ping_rssi_state; > > > > - if (!priv->up) { > > + if (!priv->up) > > return; > > - } > > > > if (pra->rate_adaptive_disabled) > > return; > > @@ -777,9 +775,8 @@ static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev) > > tmpRegA = rtl92e_get_bb_reg(dev, rOFDM0_XATxIQImbalance, > > bMaskDWord); > > for (i = 0; i < OFDM_Table_Length; i++) { > > - if (tmpRegA == OFDMSwingTable[i]) { > > + if (tmpRegA == OFDMSwingTable[i]) > > priv->OFDM_index[0] = i; > > - } > > } > > > > TempCCk = rtl92e_get_bb_reg(dev, rCCK0_TxFilter1, bMaskByte2); > > @@ -1066,9 +1063,8 @@ void rtl92e_dm_restore_state(struct net_device *dev) > > u32 reg_ratr = priv->rate_adaptive.last_ratr; > > u32 ratr_value; > > > > - if (!priv->up) { > > + if (!priv->up) > > return; > > - } > > > > if (priv->rate_adaptive.rate_adaptive_disabled) > > return; > > @@ -1877,20 +1873,16 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev) > > tmp_cck_sec_pwdb = cur_cck_pwdb; > > cck_rx_ver2_sec_index = i; > > } else if (cur_cck_pwdb == > > - tmp_cck_sec_pwdb) { > > - if (tmp_cck_sec_pwdb == > > - tmp_cck_min_pwdb) { > > - tmp_cck_sec_pwdb = > > - cur_cck_pwdb; > > - cck_rx_ver2_sec_index = > > - i; > > - } > > + tmp_cck_sec_pwdb && > > + tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { > > + tmp_cck_sec_pwdb = cur_cck_pwdb; > > + cck_rx_ver2_sec_index = i; > > This is not functionally equivalent. Are you sure the entire if else > chain still behaves correctly? > > > } else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) && > > (cur_cck_pwdb > tmp_cck_min_pwdb)) { > > ; > > - } else if (cur_cck_pwdb == tmp_cck_min_pwdb) { > > - if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb) > > - tmp_cck_min_pwdb = cur_cck_pwdb; > > + } else if (cur_cck_pwdb == tmp_cck_min_pwdb && > > + tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { > > + tmp_cck_min_pwdb = cur_cck_pwdb; > > Same story as above. > > > } else if (cur_cck_pwdb < tmp_cck_min_pwdb) { > > tmp_cck_min_pwdb = cur_cck_pwdb; > > } > > diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c > > index 19d13b3fcecf..e932ad1a9e96 100644 > > --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c > > +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c > > @@ -180,11 +180,10 @@ static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst, > > > > skb = rtllib_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); > > > > - if (skb) { > > + if (skb) > > softmac_mgmt_xmit(skb, ieee); > > - } else { > > + else > > netdev_dbg(ieee->dev, "Failed to generate ADDBAReq packet.\n"); > > - } > > } > > > > static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst, > > diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c > > index ef3dca51cf99..b763cf0ba356 100644 > > --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c > > +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c > > @@ -70,6 +70,7 @@ static u8 LINKSYS_MARVELL_4400N[3] = {0x00, 0x14, 0xa4}; > > void HTUpdateDefaultSetting(struct rtllib_device *ieee) > > { > > struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; > > + > > pHTInfo->bRegShortGI20MHz = 1; > > pHTInfo->bRegShortGI40MHz = 1; > > > > diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c > > index 46d75e925ee9..ca7eba826ece 100644 > > --- a/drivers/staging/rtl8192e/rtllib_rx.c > > +++ b/drivers/staging/rtl8192e/rtllib_rx.c > > @@ -454,14 +454,14 @@ static bool AddReorderEntry(struct rx_ts_record *pTS, > > while (pList->next != &pTS->rx_pending_pkt_list) { > > if (SN_LESS(pReorderEntry->SeqNum, ((struct rx_reorder_entry *) > > list_entry(pList->next, struct rx_reorder_entry, > > - List))->SeqNum)) > > + List))->SeqNum)) { > > pList = pList->next; > > - else if (SN_EQUAL(pReorderEntry->SeqNum, > > + continue; > > + } else if (SN_EQUAL(pReorderEntry->SeqNum, > > ((struct rx_reorder_entry *)list_entry(pList->next, > > struct rx_reorder_entry, List))->SeqNum)) > > return false; > > - else > > - break; > > + break; > > } > > pReorderEntry->List.next = pList->next; > > pReorderEntry->List.next->prev = &pReorderEntry->List; > > diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c > > index f9589c5b62ba..4fc4fb25d8d6 100644 > > --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c > > +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c > > @@ -41,8 +41,8 @@ int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a, > > > > /* if setting by freq convert to channel */ > > if (fwrq->e == 1) { > > - if ((fwrq->m >= (int)2.412e8 && > > - fwrq->m <= (int)2.487e8)) { > > + if ((fwrq->m >= 2.412e8 && > > + fwrq->m <= 2.487e8)) { > > This turns integer conversions into floating point conversions. I don't > this floating point operations are allowed in the kernel. Sorry I was a bit sleepy writing this. I meant "This turns integer comparisons into floating point comparisons. I don't think floating point operations are allowed in the kernel."