Staging: rtl8723au: rtw_xmit: Remove unnecessary tests
PATCH v2 1/1 Staging: rtl8723au: rtw_xmit: Remove unnecessary tests
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3
---
Changes in v2:
-Correct the semantic patch and make commit message better.
drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/staging/rtl8723au/core/rtw_xmit.c +0 -9
@@ -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);
Signature · 1 line
2.1.0
Quoted 24 lines · Shivani Bhardwaj
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Correct the semantic patch and make commit message better.drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)drivers/staging/rtl8723au/core/rtw_xmit.c +0
-0
drivers/staging/rtl8723au/core/rtw_xmit.c static int xmitframe_addmic(struct rtw_adapter *padapter, · line 672
Quoted 7 lines
drivers/staging/rtl8723au/core/rtw_xmit.c +0
-1@@ -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 ,
Now this indention is looking wrong.
regards
sudip
Quoted 35 lines · Sudip Mukherjee
Quoted 24 lines · Shivani Bhardwaj
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Correct the semantic patch and make commit message better.drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)drivers/staging/rtl8723au/core/rtw_xmit.c +0
-0drivers/staging/rtl8723au/core/rtw_xmit.c static int xmitframe_addmic(struct rtw_adapter *padapter, · line 672
Quoted 7 lines
drivers/staging/rtl8723au/core/rtw_xmit.c +0
-1@@ -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 ,Now this indention is looking wrong.
Quoted 2 lines
regards
sudip
Is it also supposed to be a part of the same patch or a series should be made?
Quoted 37 lines · Shivani Bhardwaj
Quoted 35 lines · Sudip Mukherjee
Quoted 24 lines · Shivani Bhardwaj
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Correct the semantic patch and make commit message better.drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)drivers/staging/rtl8723au/core/rtw_xmit.c +0
-0drivers/staging/rtl8723au/core/rtw_xmit.c static int xmitframe_addmic(struct rtw_adapter *padapter, · line 672
Quoted 7 lines
drivers/staging/rtl8723au/core/rtw_xmit.c +0
-1@@ -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 ,Now this indention is looking wrong.
Quoted 3 lines
Quoted 2 lines
regards
sudipIs it also supposed to be a part of the same patch or a series should be made?
same patch as that indention problem is caused as "if (stainfo) {" is removed. But can the cocci script handle that? maybe you need to modify the indention by hand, and mention that in the commit message.
regards
sudip
Quoted 40 lines · Sudip Mukherjee
Quoted 39 lines · Shivani Bhardwaj
Quoted 37 lines · Sudip Mukherjee
Quoted 24 lines · Shivani Bhardwaj
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Correct the semantic patch and make commit message better.drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)drivers/staging/rtl8723au/core/rtw_xmit.c +0
-0drivers/staging/rtl8723au/core/rtw_xmit.c static int xmitframe_addmic(struct rtw_adapter *padapter, · line 672
Quoted 7 lines
drivers/staging/rtl8723au/core/rtw_xmit.c +0
-1@@ -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 ,Now this indention is looking wrong.
regards
sudip
Quoted 8 lines
Quoted 1 line
Is it also supposed to be a part of the same patch or a series should be made?
same patch as that indention problem is caused as "if (stainfo) {" is removed. But can the cocci script handle that? maybe you need to modify the indention by hand, and mention that in the commit message.
regards
sudip
I don't know if cocci script can do that. I'll have to ask Julia. Anyway, I'll make the changes by hand.
Quoted 48 lines · Shivani Bhardwaj
Quoted 46 lines · Sudip Mukherjee
Quoted 37 lines · Shivani Bhardwaj
Quoted 35 lines · Sudip Mukherjee
Quoted 24 lines · Shivani Bhardwaj
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Correct the semantic patch and make commit message better.drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)drivers/staging/rtl8723au/core/rtw_xmit.c +0
-0drivers/staging/rtl8723au/core/rtw_xmit.c static int xmitframe_addmic(struct rtw_adapter *padapter, · line 672
Quoted 7 lines
drivers/staging/rtl8723au/core/rtw_xmit.c +0
-1@@ -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 ,Now this indention is looking wrong.
Quoted 3 lines
Quoted 2 lines
regards
sudipIs it also supposed to be a part of the same patch or a series should be made?
same patch as that indention problem is caused as "if (stainfo) {" is removed. But can the cocci script handle that? maybe you need to modify the indention by hand, and mention that in the commit message.
Quoted 5 lines
Quoted 2 lines
regards
sudipI don't know if cocci script can do that. I'll have to ask Julia. Anyway, I'll make the changes by hand.
Coccinelle is supposed to clean up the indentation, but it seems that it is not. Could you send me your semantic patch, and I will check on it.
thanks,
julia
Quoted 55 lines · Julia Lawall
Quoted 51 lines · Shivani Bhardwaj
Quoted 48 lines · Sudip Mukherjee
Quoted 37 lines · Shivani Bhardwaj
Quoted 35 lines · Sudip Mukherjee
Quoted 24 lines · Shivani Bhardwaj
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Correct the semantic patch and make commit message better.drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)drivers/staging/rtl8723au/core/rtw_xmit.c +0
-0drivers/staging/rtl8723au/core/rtw_xmit.c static int xmitframe_addmic(struct rtw_adapter *padapter, · line 672
Quoted 7 lines
drivers/staging/rtl8723au/core/rtw_xmit.c +0
-1@@ -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 ,Now this indention is looking wrong.
Quoted 3 lines
Quoted 2 lines
regards
sudipIs it also supposed to be a part of the same patch or a series should be made?
same patch as that indention problem is caused as "if (stainfo) {" is removed. But can the cocci script handle that? maybe you need to modify the indention by hand, and mention that in the commit message.
regards
sudip
Quoted 8 lines
Quoted 2 lines
I don't know if cocci script can do that. I'll have to ask Julia. Anyway, I'll make the changes by hand.
Coccinelle is supposed to clean up the indentation, but it seems that it is not. Could you send me your semantic patch, and I will check on it.
thanks,
julia
I just used the script to detect null tests. I used
http://coccinelle.lip6.fr/rules/notnull.cocci .
I still don't know well about making changes to cocci scripts. :(
Quoted 37 lines · Shivani Bhardwaj
Quoted 35 lines · Sudip Mukherjee
Quoted 24 lines · Shivani Bhardwaj
The variables which are preceded by NULL tests on them should not be checked again.
Semantic patch used:
@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Correct the semantic patch and make commit message better.drivers/staging/rtl8723au/core/rtw_xmit.c | 9 --------- 1 file changed, 9 deletions(-)drivers/staging/rtl8723au/core/rtw_xmit.c +0
-0drivers/staging/rtl8723au/core/rtw_xmit.c static int xmitframe_addmic(struct rtw_adapter *padapter, · line 672
Quoted 7 lines
drivers/staging/rtl8723au/core/rtw_xmit.c +0
-1@@ -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 ,Now this indention is looking wrong.
Quoted 3 lines
Quoted 2 lines
regards
sudipIs it also supposed to be a part of the same patch or a series should be made?
Same. The removal caused the indentation problem, so the same patch should fix it up.
julia
Quoted 8 lines
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAKHNQQGOs9OPBZi6Eoy3t7R1ybZf5kmnTUJx9JRxGTmhAhmCjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.