Skip to contentSkip to conversation

staging: rtl8723bs: Remove unnecessary parentheses

PATCH In review Payal Kshirsagar 2 participants 3 messages Mar 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: Remove unnecessary parentheses

Challenge suggested by coccinelle

This patch removes unnecessary parentheses while returning a value. Using following semantic patch:

@@
local idexpression id;
@@

- return(id);
+ return id;

---

os_dep/ioctl_linux.c +2 -2
diff -u -p a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c
@@ -961,7 +961,7 @@ static int rtw_wx_set_pmkid(struct net_d
         if (pPMK->cmd == IW_PMKSA_ADD) {
                 DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n");
                 if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN))
-                    return(intReturn);
+                    return intReturn;
                 else
                     intReturn = true;
 
@@ -1489,7 +1489,7 @@ exit:
 	DBG_871X("DBG_IOCTL %s:%d return %d\n", __func__, __LINE__, ret);
 	#endif
 
-	return ret ;
+	return ret;
 
 }
 
#1 lore raw
Quoted 27 lines · Payal Kshirsagar

Challenge suggested by coccinelle

This patch removes unnecessary parentheses while returning a value. Using following semantic patch:

@@
local idexpression id;
@@

- return(id);
+ return id;

---
diff -u -p a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c

os_dep/ioctl_linux.c +1 -1
@@ -961,7 +961,7 @@ static int rtw_wx_set_pmkid(struct net_d
         if (pPMK->cmd == IW_PMKSA_ADD) {
                 DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n");
                 if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN))
-                    return(intReturn);
+                    return intReturn;
                 else
                     intReturn = true;
 

os_dep/ioctl_linux.c exit: · line 1492

Quoted 5 lines
os_dep/ioctl_linux.c +1 -1
@@ -1489,7 +1489,7 @@ exit:
 	DBG_871X("DBG_IOCTL %s:%d return %d\n", __func__, __LINE__, ret);
 	#endif
 
-	return ret ;
+	return ret;

There are two kinds of change: one drops parentheses and one drops a space. Both are good, but they should be in two separate patches.

The second one is because Coccinelle implicitly ignores parentheses, unless you tell it not to, so it actually matches and repretty prints all returns. In the second case it caused a change.

julia

Quoted 11 lines
os_dep/ioctl_linux.c +0 -1
 }
 
 
--

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/1553781808-10349-1-git-send-email-payal.s.kshirsagar.98%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 34 lines · Julia Lawall
Quoted 30 lines · Payal Kshirsagar

Challenge suggested by coccinelle

This patch removes unnecessary parentheses while returning a value. Using following semantic patch:

@@
local idexpression id;
@@

- return(id);
+ return id;

---
diff -u -p a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c

os_dep/ioctl_linux.c +1 -1
@@ -961,7 +961,7 @@ static int rtw_wx_set_pmkid(struct net_d
         if (pPMK->cmd == IW_PMKSA_ADD) {
                 DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n");
                 if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN))
-                    return(intReturn);
+                    return intReturn;
                 else
                     intReturn = true;
 
@@ -1489,7 +1489,7 @@ exit:
      DBG_871X("DBG_IOCTL %s:%d return %d\n", __func__, __LINE__, ret);
      #endif
 
Quoted 6 lines

os_dep/ioctl_linux.c exit: · line 1492

Quoted 2 lines
os_dep/ioctl_linux.c +1 -1
-     return ret ;
+     return ret;

There are two kinds of change: one drops parentheses and one drops a space. Both are good, but they should be in two separate patches.

Okay, I will put them in different patches and will send it again. Thanks,
Payal

The second one is because Coccinelle implicitly ignores parentheses,

Quoted 32 lines

unless you tell it not to, so it actually matches and repretty prints all returns. In the second case it caused a change.

julia

Quoted 6 lines
os_dep/ioctl_linux.c +0 -1
 }
 
 
--

You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

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/1553781808-10349-1-git-send-email-payal.s.kshirsagar.98%40gmail.com
.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

--
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/alpine.DEB.2.21.1903281525280.2438%40hadrien
.
For more options, visit https://groups.google.com/d/optout.