Skip to contentSkip to conversation

staging: rtl8712: Place constants on the right side of '!'

PATCH In review Bhaktipriya Shridhar 2 participants 2 messages Feb 21, 2016 – Mar 11, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/3 staging: rtl8712: Place constants on the right side of '!'

Move constants to the right of binary operator '!'. This issue was identified using the Coccinelle script:
@@
constant c,c1;
expression e,e1,e2;
local idexpression i;
binary operator b = {==,!=,&,|};
@@

(
c b (c1)
|
i b e1
|
c | e1 | e2 | ...
|
c | (e ? e1 : e2)
|
- c
+ e
b
- e
+ c
)

---
Changes in v2:
-change subject line
-inserted Coccinelle script

 drivers/staging/rtl8712/rtl8712_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl8712_recv.c +1 -1
index d187508..4fd106a 100644
@@ -1109,7 +1109,7 @@ static void recv_tasklet(void *priv)
 	struct _adapter *padapter = (struct _adapter *)priv;
 	struct recv_priv *precvpriv = &padapter->recvpriv;
 
-	while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) {
+	while ((pskb = skb_dequeue(&precvpriv->rx_skb_queue)) != NULL) {
 		recvbuf2recvframe(padapter, pskb);
 		skb_reset_tail_pointer(pskb);
 		pskb->len = 0;

--
2.1.4

maintainer
#1 lore raw
Quoted 38 lines · Bhaktipriya Shridhar

Move constants to the right of binary operator '!'. This issue was identified using the Coccinelle script:
@@
constant c,c1;
expression e,e1,e2;
local idexpression i;
binary operator b = {==,!=,&,|};
@@

(
c b (c1)
|
i b e1
|
c | e1 | e2 | ...
|
c | (e ? e1 : e2)
|
- c
+ e
b
- e
+ c
)

---
Changes in v2:
-change subject line
-inserted Coccinelle script

 drivers/staging/rtl8712/rtl8712_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl8712_recv.c +0 -0
index d187508..4fd106a 100644

drivers/staging/rtl8712/rtl8712_recv.c static void recv_tasklet(void *priv) · line 1112

Quoted 5 lines
drivers/staging/rtl8712/rtl8712_recv.c +1 -1
@@ -1109,7 +1109,7 @@ static void recv_tasklet(void *priv)
 	struct _adapter *padapter = (struct _adapter *)priv;
 	struct recv_priv *precvpriv = &padapter->recvpriv;
 
-	while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) {
+	while ((pskb = skb_dequeue(&precvpriv->rx_skb_queue)) != NULL) {

Please break the assignment out of the while() statement to make this more readable and understandable.