From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6205299530591633408 X-Received: by 10.180.208.7 with SMTP id ma7mr642946wic.5.1444816804140; Wed, 14 Oct 2015 03:00:04 -0700 (PDT) X-BeenThere: outreachy-kernel@googlegroups.com Received: by 10.180.10.97 with SMTP id h1ls97401wib.26.gmail; Wed, 14 Oct 2015 03:00:03 -0700 (PDT) X-Received: by 10.180.9.104 with SMTP id y8mr5305598wia.7.1444816803774; Wed, 14 Oct 2015 03:00:03 -0700 (PDT) Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr. [192.134.164.104]) by gmr-mx.google.com with ESMTPS id bh7si867800wib.1.2015.10.14.03.00.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 03:00:03 -0700 (PDT) Received-SPF: neutral (google.com: 192.134.164.104 is neither permitted nor denied by domain of julia.lawall@lip6.fr) client-ip=192.134.164.104; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.134.164.104 is neither permitted nor denied by domain of julia.lawall@lip6.fr) smtp.mailfrom=julia.lawall@lip6.fr X-IronPort-AV: E=Sophos;i="5.17,681,1437429600"; d="scan'208";a="150504826" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Oct 2015 12:00:03 +0200 Date: Wed, 14 Oct 2015 12:00:00 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Shivani Bhardwaj cc: outreachy-kernel Subject: Re: [Outreachy kernel] [PATCH] Staging: rtl8723au: rtw_xmit: Remove extra NULL tests In-Reply-To: Message-ID: References: <20151014005112.GA26569@ubuntu> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 14 Oct 2015, Shivani Bhardwaj wrote: > On Wed, Oct 14, 2015 at 3:21 PM, Julia Lawall wrote: > >> @@ expression E; > >> statement S; @@ > >> if(E==NULL) {... return ...;} > >> else S > >> - if(E==NULL) > >> { > >> ... > >> } > >> - else S > >> > >> How about this? > > > > That's better. But actually, you don't care about whether there are > > braces, so you could just put S1. > > > > Actually, there is also no need to require that the else of the second if > > is the same as the else of the first one. So you should have a different > > statement metavariable in each case. > > > > julia > > > @@ expression E; > statement S1, S2; @@ > if(E==NULL) {... return ...;} > else S1 > - if(E==NULL) > - else S2 > > This should be fine, I think? No, an if has two branches, then an else. You can omit the else, but here you have omitted the then, so it doesn't work. Actually, you can check your semantic patch by putting it in a file file.cocci, and then running spatch --parse-cocci file.cocci julia > > >> > >> >> > > >> >> > Can you check this one, Julia? > >> >> > > >> >> >>> > >> >> >>> Signed-off-by: Shivani Bhardwaj > >> >> >>> --- > >> >> >>> drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- > >> >> >>> 1 file changed, 9 deletions(-) > >> >> >>> > >> >> >>> diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c > >> >> >>> index a4b6bb6..0ea521b 100644 > >> >> >>> --- a/drivers/staging/rtl8723au/core/rtw_xmit.c > >> >> >>> +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c > >> >> >>> @@ -667,7 +667,6 @@ static int xmitframe_addmic(struct rtw_adapter *padapter, > >> >> >>> > >> >> >>> if (pattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) { > >> >> >>> /* encode mic code */ > >> >> >>> - if (stainfo) { > >> >> >>> u8 null_key[16]={0x0, 0x0, 0x0, 0x0, > >> >> >>> 0x0, 0x0, 0x0, 0x0, > >> >> >>> 0x0, 0x0, 0x0, 0x0, > >> >> >>> @@ -792,10 +791,6 @@ static int xmitframe_addmic(struct rtw_adapter *padapter, > >> >> >>> *(payload + curfragnum + 6), > >> >> >>> *(payload + curfragnum + 7)); > >> >> >>> } > >> >> >>> - } else { > >> >> >>> - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, > >> >> >>> - "xmitframe_addmic: rtw_get_stainfo23a ==NULL!!!\n"); > >> >> >>> - } > >> >> >>> } > >> >> >>> > >> >> >>> return _SUCCESS; > >> >> >>> @@ -934,7 +929,6 @@ static int rtw_make_wlanhdr(struct rtw_adapter *padapter, u8 *hdr, > >> >> >>> /* TODO: fill HT Control Field */ > >> >> >>> > >> >> >>> /* Update Seq Num will be handled by f/w */ > >> >> >>> - if (psta) { > >> >> >>> psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; > >> >> >>> psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; > >> >> >>> pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority]; > >> >> >>> @@ -970,7 +964,6 @@ static int rtw_make_wlanhdr(struct rtw_adapter *padapter, u8 *hdr, > >> >> >>> pattrib->ampdu_en = true;/* AGG EN */ > >> >> >>> } > >> >> >>> } > >> >> >>> - } > >> >> >>> } > >> >> >>> exit: > >> >> >>> return res; > >> >> >>> @@ -1132,7 +1125,6 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb, > >> >> >>> > >> >> >>> /* adding icv, if necessary... */ > >> >> >>> if (pattrib->iv_len) { > >> >> >>> - if (psta) { > >> >> >>> switch (pattrib->encrypt) { > >> >> >>> case WLAN_CIPHER_SUITE_WEP40: > >> >> >>> case WLAN_CIPHER_SUITE_WEP104: > >> >> >>> @@ -1158,7 +1150,6 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb, > >> >> >>> psta->dot11txpn, 0); > >> >> >>> break; > >> >> >>> } > >> >> >>> - } > >> >> >>> > >> >> >>> memcpy(pframe, pattrib->iv, pattrib->iv_len); > >> >> >>> > >> >> >>> -- > >> >> >>> 2.1.0 > >> >> >>> > >> >> >>> -- > >> >> >>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > >> >> >>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com. > >> >> >>> To post to this group, send email to outreachy-kernel@googlegroups.com. > >> >> >>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151014005112.GA26569%40ubuntu. > >> >> >>> For more options, visit https://groups.google.com/d/optout. > >> >> >>> > >> >> > >> >