Skip to contentSkip to conversation

staging: rtl8188eu: core: Remove useless return variables

PATCH Superseded Bhaktipriya Shridhar 2 participants 2 messages Feb 24, 2016 Staging

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/8 staging: rtl8188eu: core: Remove useless return variables

This patch removes unnecessary return variables and compresses the return logic.
The coccinelle script that finds and fixes this issue is:

@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)

---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +1 -3
index ce655b6..d002f4a 100644
@@ -488,11 +488,9 @@ exit:
 
 struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
 {
-	struct sta_info		*psta;
 	struct sta_priv		*pstapriv = &padapter->stapriv;
 	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-	 psta = rtw_get_stainfo(pstapriv, bc_addr);
-	return psta;
+	 return rtw_get_stainfo(pstapriv, bc_addr);
 }
 
 u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)

--
2.1.4

#1 lore raw
Quoted 26 lines · Bhaktipriya Shridhar

This patch removes unnecessary return variables and compresses the return logic.
The coccinelle script that finds and fixes this issue is:

@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)

---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +0 -0
index ce655b6..d002f4a 100644

drivers/staging/rtl8188eu/core/rtw_sta_mgt.c exit: · line 493

Quoted 9 lines
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +1 -3
@@ -488,11 +488,9 @@ exit:
 
 struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
 {
-	struct sta_info		*psta;
 	struct sta_priv		*pstapriv = &padapter->stapriv;
 	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-	 psta = rtw_get_stainfo(pstapriv, bc_addr);
-	return psta;
+	 return rtw_get_stainfo(pstapriv, bc_addr);

There is an extra space before the return. Checkpatch should have complained.

julia

Quoted 13 lines
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +0 -1
 }
 
 u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
--

2.1.4

Signature · 5 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/20160224202720.GA22977%40Karyakshetra.
For more options, visit https://groups.google.com/d/optout.