All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle.
@ 2019-03-21 11:12 Sanjana Sanikommu
  2019-03-21 19:01 ` [Outreachy kernel] " Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Sanjana Sanikommu @ 2019-03-21 11:12 UTC (permalink / raw)
  To: gregkh; +Cc: outreachy-kernel

The last two lines in the function could
be compressed into one. Avoid usage of local variable.
Challenge suggested by Coccinelle using ret.cocci.
The below is the script for ret.cocci:
@@
local idexpression res;
expression e;
@@

-res =
+return
     e;
-return res;

Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 4480deef95a1..70776f8e19a6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1182,10 +1182,8 @@ unsigned int update_MSC_rate(struct ieee80211_ht_cap *pHT_caps)
 {
 	unsigned int mask = 0;
 
-	mask = (pHT_caps->mcs.rx_mask[0] << 12) |
+	return (pHT_caps->mcs.rx_mask[0] << 12) |
 	       (pHT_caps->mcs.rx_mask[1] << 20);
-
-	return mask;
 }
 
 int support_short_GI(struct adapter *padapter, struct ieee80211_ht_cap *pHT_caps)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-24  7:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-21 11:12 [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle Sanjana Sanikommu
2019-03-21 19:01 ` [Outreachy kernel] " Greg KH
2019-03-22 15:27   ` sanjana99reddy99
2019-03-22 15:43     ` Julia Lawall
2019-03-22 16:05     ` Greg KH
2019-03-24  7:15       ` sanjana99reddy99

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.