Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp369766ybh; Sat, 18 Jul 2020 06:37:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWJJiJ/bde1yaRZiGIzo4EXk/2oFIR6pQiYjbIeRplcf8Wm+pd1wJTNHEY0Sok0SUpu7W/ X-Received: by 2002:aa7:c1d8:: with SMTP id d24mr13987096edp.178.1595079427032; Sat, 18 Jul 2020 06:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595079427; cv=none; d=google.com; s=arc-20160816; b=Y6hydafrGR1shJjd2cb6g156x4TqP9pwQkNZUKJ71b5XNGAcFBbU/USLLrSpS1B611 /yECowOZkzA/1QDkDj/hetvN1ysQ20X2VxezKs8N2H9FldQ502KuGuKW4ph3KarOZWqb Jxp0zboPBE8LZiybioawDe8GEsHj/CUyH3h6dgK4KLdjlCZrIxMtnHg8tyCnOzr7MKfT WglbTqsugay9dojcrk3y08S+LN/+p24tE8cYXWDh047P+RP7TxOZihfwvjpQoWbvelp8 z1cc9Sn3culOGFJxXo0k4pEYusje2sJ4cEzQ8yS017h3KB6lTMmpkhKzdBjpmVwmCTjP L7cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PV7hHvU5WTJVLxmjDtytdt4i+Ojp5k4NkU4sJzhexD0=; b=G/DxORUAZKp8sj1w5h3GSAt5+1By8+7IAj2Rfb+eFLLxYHzK2fhXP8/zegZPTxDRVw kPFWz9dSgTt6xqpv3gdLqAgZoOwrB/hch6EQIe+QWJd5Sj6sI+s2QZVhxtZaKA+TZeOM xZFo+3SwVWQ4/l+C99sy8CVuanONvVmqj/zoIHrzfRgbdbgOFBYtSxqE2nPiCAdsAPka beMsHTg1oYNqn0cC8pefLKkGUBqe/S3tlZUINK9pBQcoyKAlTbHxvvOUL+iSMibCUebx YvWlun+KU9PYoK2WezAZvMSpvp+5p5r0Wvz8+yP3D0s3nOC8FLG+CUh/tVr+r2CE2ryZ VTew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pesu-pes-edu.20150623.gappssmtp.com header.s=20150623 header.b=rTV+fN6S; 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=pes.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si7341423edy.149.2020.07.18.06.36.44; Sat, 18 Jul 2020 06:37:07 -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=@pesu-pes-edu.20150623.gappssmtp.com header.s=20150623 header.b=rTV+fN6S; 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=pes.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbgGRNe3 (ORCPT + 99 others); Sat, 18 Jul 2020 09:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726569AbgGRNe2 (ORCPT ); Sat, 18 Jul 2020 09:34:28 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 455A6C0619D2 for ; Sat, 18 Jul 2020 06:34:28 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id e8so15749263ljb.0 for ; Sat, 18 Jul 2020 06:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pesu-pes-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PV7hHvU5WTJVLxmjDtytdt4i+Ojp5k4NkU4sJzhexD0=; b=rTV+fN6SCUZ/GEu9Vs6WW3JrFjNFu1XC/ZBSCEiNkL/2M5nt8jhGAJjafm4fYUq5kJ yWTP4jBeYEnOEdR1GDNp4bn/zGngGh3Ln+nHKgI7miC7SbLtf2Ua4vxQA6WZ3nVAhdn5 BkCFvPNIO8zHhYDpw2mDUwZUFUEq1B/uhmZ3kuRRFmBeXP79l1ku7hTfsxg+Ru2u75Ur +n76KOf+GwEMIQp11ZHZy4sz0Pi36YrfodmH8JpQJsqy7GaqggIDp5MKaiNpnsyN9ZAV SFAOO4rVQCDhOyuAfJ7+qZr9YjYnoN5rtfr6G6utH1KKHLQQ8WGQBsx5Yyvp/ucQlRXP EyIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PV7hHvU5WTJVLxmjDtytdt4i+Ojp5k4NkU4sJzhexD0=; b=iwtN3bhSAKjQ7k+mIISoFcJMggU7S6sas459F70ivqiwZCN4yEUYQzEISv8UNVO1Ct 6zBDMhKNBoQMBDDFMQIHI6cTRSDB/MF0QiCBU9jL4jWrQeIT4pfwaoI2o+KbuNlYJlf4 80Qe8nz5MQwS0V7UF1Bc5yUzX0c62Hc5yVeGeoThvwz7cgT7lRq//q4iXZ88SkLwqj3r akPY+i/FolgyD3BySHR8YpTiW4/h2pFJwPbbk90ibgzziqGqLiN1xu6lqgjXrWJfv3Mp oVrj1qpwx508lRgPnldVdP55zHGuFZAGccD3OHWDnEPJ6lPpyQE93J1HgRl8V05aWZb/ hvVw== X-Gm-Message-State: AOAM5331n3YIy7j+lgUqpmKOhItdfSciY9TvWkarh9dZyj634jJXc5Qs qd/8Ryu5j0ClPpZeY1WFlNRkIZcDQyxwpMzGScULRw== X-Received: by 2002:a2e:9b92:: with SMTP id z18mr7058455lji.364.1595079266712; Sat, 18 Jul 2020 06:34:26 -0700 (PDT) MIME-Version: 1.0 References: <20200718091857.quzs5sqvkjzngd6k@pesu-pes-edu> <560eeb7388164e58ac0e47277fe2aec798c45a5c.camel@perches.com> In-Reply-To: <560eeb7388164e58ac0e47277fe2aec798c45a5c.camel@perches.com> From: B K Karthik Date: Sat, 18 Jul 2020 09:34:15 -0400 Message-ID: Subject: Re: [PATCH 4/4] staging: rtl8188eu: include: placed constant on the right side of the test in comparisons To: Joe Perches Cc: Larry Finger , Greg Kroah-Hartman , Michael Straube , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 18, 2020 at 9:17 AM Joe Perches wrote: > > On Sat, 2020-07-18 at 05:18 -0400, B K Karthik wrote: > > placed constant on the right side of the test > > to fix warnings issued by checkpatch > [] > > diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h > [] > > @@ -326,7 +326,7 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe) > > > > static inline int IsFrameTypeCtrl(unsigned char *pframe) > > { > > - if (WIFI_CTRL_TYPE == GetFrameType(pframe)) > > + if (GetFrameType(pframe) == WIFI_CTRL_TYPE) > > return true; > > else > > return false; > > Always try to improve code instead of merely shutting > up checkpatch warnings. > > This function should likely be written: > > static inline bool IsFrameTypeCtrl(unsigned char *pframe) > { > return GetFrameType(pframe) == WIFI_CTRL_TYPE; > } > > and given it's used only once, it might be expanded > in that place and removed altogether. > > Something like: > > (and the memcmp below could be ether_addr_equal instead > but I'm too lazy to find out if the addresses are both > guaranteed to be __aligned(2) which is likely) Alright, I will try to do that and send a v2 asap :) > > --- > drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 8 +++++--- > drivers/staging/rtl8188eu/include/wifi.h | 7 ------- > 2 files changed, 5 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c > index 7d0135fde795..a2994f9ecbde 100644 > --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c > +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c > @@ -144,10 +144,12 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, > > wlanhdr = precvframe->pkt->data; > > - pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) && > - !pattrib->icv_err && !pattrib->crc_err && > + pkt_info.bPacketMatchBSSID = > + GetFrameType(wlanhdr) != WIFI_CTRL_TYPE && > + !pattrib->icv_err && > + !pattrib->crc_err && > !memcmp(get_hdr_bssid(wlanhdr), > - get_bssid(&padapter->mlmepriv), ETH_ALEN)); > + get_bssid(&padapter->mlmepriv), ETH_ALEN); > > pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && > (!memcmp(get_da(wlanhdr), > diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h > index 791f287a546d..3998d5633860 100644 > --- a/drivers/staging/rtl8188eu/include/wifi.h > +++ b/drivers/staging/rtl8188eu/include/wifi.h > @@ -324,13 +324,6 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe) > return sa; > } > > -static inline int IsFrameTypeCtrl(unsigned char *pframe) > -{ > - if (WIFI_CTRL_TYPE == GetFrameType(pframe)) > - return true; > - else > - return false; > -} > /*----------------------------------------------------------------------------- > Below is for the security related definition > ------------------------------------------------------------------------------*/ thank you for pointing me. karthik