Skip to contentSkip to conversation

Compress two lines into one line

PATCH In review Payal Kshirsagar 2 participants 8 messages Mar 30, 2019 Staging

lore
Share & tools
lore
#0 lore raw

cover Compress two lines into one line

Challenge suggested by coccinelle.
This patchset compresses two lines into one line and removes unnecessary variables.

Payal Kshirsagar (5):
staging: rtl8723bs: core: rtw_efuse.c: Compress two lines into one
line
staging: rtl8723bs: core: rtw_cmd.c: Compress two lines into one line
staging: rtl8723bs: hal: hal_com.c: Compress two lines into one line
staging: rtl8723bs: core: rtw_pwrctrl.c: Compress two lines into one
line
staging: rtl8723bs: core: rtw_mlme.c: Compress two lines into one line

 drivers/staging/rtl8723bs/core/rtw_cmd.c     | 10 ++-------
 drivers/staging/rtl8723bs/core/rtw_efuse.c   | 33 +++++++++-------------------
 drivers/staging/rtl8723bs/core/rtw_mlme.c    |  5 +----
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c |  7 +-----
 drivers/staging/rtl8723bs/hal/hal_com.c      |  5 +----
 5 files changed, 15 insertions(+), 45 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 staging: rtl8723bs: core: rtw_efuse.c: Compress two lines into one line

Challenge suggested by coccinelle.
Return value directly without saving it in a variable and remove that variable.

---
 drivers/staging/rtl8723bs/core/rtw_efuse.c | 33 +++++++++---------------------
 1 file changed, 10 insertions(+), 23 deletions(-)
drivers/staging/rtl8723bs/core/rtw_efuse.c +10 -23
index eea3bec..3b88481 100644
@@ -125,11 +125,8 @@ Efuse_GetCurrentSize(
 	u8 	efuseType,
 	bool		bPseudoTest)
 {
-	u16 ret = 0;
-
-	ret = padapter->HalFunc.EfuseGetCurrentSize(padapter, efuseType, bPseudoTest);
-
-	return ret;
+	return padapter->HalFunc.EfuseGetCurrentSize(padapter, efuseType,
+						     bPseudoTest);
 }
 
 /*  11/16/2008 MH Add description. Get current efuse area enabled word!!. */
@@ -221,7 +218,6 @@ EFUSE_Read1Byte(
 struct adapter *Adapter,
 u16 	Address)
 {
-	u8 data;
 	u8 Bytetemp = {0x00};
 	u8 temp = {0x00};
 	u32 k = 0;
@@ -253,8 +249,7 @@ u16 	Address)
 				break;
 			}
 		}
-		data = rtw_read8(Adapter, EFUSE_CTRL);
-		return data;
+		return rtw_read8(Adapter, EFUSE_CTRL);
 	} else
 		return 0xFF;
 
@@ -378,11 +373,8 @@ Efuse_PgPacketRead(struct adapter *padapter,
 				u8 	*data,
 				bool		bPseudoTest)
 {
-	int	ret = 0;
-
-	ret =  padapter->HalFunc.Efuse_PgPacketRead(padapter, offset, data, bPseudoTest);
-
-	return ret;
+	return padapter->HalFunc.Efuse_PgPacketRead(padapter, offset, data,
+						    bPseudoTest);
 }
 
 int
@@ -392,11 +384,8 @@ Efuse_PgPacketWrite(struct adapter *padapter,
 				u8 	*data,
 				bool		bPseudoTest)
 {
-	int ret;
-
-	ret =  padapter->HalFunc.Efuse_PgPacketWrite(padapter, offset, word_en, data, bPseudoTest);
-
-	return ret;
+	return padapter->HalFunc.Efuse_PgPacketWrite(padapter, offset, word_en,
+						     data, bPseudoTest);
 }
 
 /*-----------------------------------------------------------------------------
@@ -447,11 +436,9 @@ Efuse_WordEnableDataWrite(struct adapter *padapter,
 						u8 *data,
 						bool		bPseudoTest)
 {
-	u8 ret = 0;
-
-	ret =  padapter->HalFunc.Efuse_WordEnableDataWrite(padapter, efuse_addr, word_en, data, bPseudoTest);
-
-	return ret;
+	return padapter->HalFunc.Efuse_WordEnableDataWrite(padapter, efuse_addr,
+							   word_en, data,
+							   bPseudoTest);
 }
 
 /*-----------------------------------------------------------------------------
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 staging: rtl8723bs: core: rtw_cmd.c: Compress two lines into one line

In reply to Payal Kshirsagar

Challenge suggested by coccinelle.
Return value directly without saving it in a variable and remove that variable.

---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +2 -8
index 91520ca..814a4b7 100644
@@ -297,18 +297,12 @@ struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue)
 
 u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
-	u32 res;
-
-	res = _rtw_init_cmd_priv(pcmdpriv);
-	return res;
+	return _rtw_init_cmd_priv(pcmdpriv);
 }
 
 u32 rtw_init_evt_priv(struct	evt_priv *pevtpriv)
 {
-	int	res;
-
-	res = _rtw_init_evt_priv(pevtpriv);
-	return res;
+	return _rtw_init_evt_priv(pevtpriv);
 }
 
 void rtw_free_evt_priv(struct	evt_priv *pevtpriv)
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 staging: rtl8723bs: hal: hal_com.c: Compress two lines into one line

In reply to Payal Kshirsagar

Challenge suggested by coccinelle.
Return value directly without saving it in a variable and remove that variable.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +1 -4
index 151e4e9..2c4b8de 100644
@@ -971,10 +971,7 @@ u8  rtw_hal_networktype_to_raid(struct adapter *adapter, struct sta_info *psta)
 
 u8 rtw_get_mgntframe_raid(struct adapter *adapter, unsigned char network_type)
 {
-
-	u8 raid;
-	raid = (network_type & WIRELESS_11B) ? RATEID_IDX_B : RATEID_IDX_G;
-	return raid;
+	return (network_type & WIRELESS_11B) ? RATEID_IDX_B : RATEID_IDX_G;
 }
 
 void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *psta)
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 staging: rtl8723bs: core: rtw_pwrctrl.c: Compress two lines into one line

In reply to Payal Kshirsagar

Challenge suggested by coccinelle.
Return value directly without saving it in a variable and remove that variable.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +1 -6
index 5c468c5..1013af1 100644
@@ -1400,10 +1400,5 @@ void rtw_ps_deny_cancel(struct adapter *padapter, enum PS_DENY_REASON reason)
  */
 u32 rtw_ps_deny_get(struct adapter *padapter)
 {
-	u32 deny;
-
-
-	deny = adapter_to_pwrctl(padapter)->ps_deny;
-
-	return deny;
+	return adapter_to_pwrctl(padapter)->ps_deny;
 }
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/5 staging: rtl8723bs: core: rtw_mlme.c: Compress two lines into one line

In reply to Payal Kshirsagar

Challenge suggested by coccinelle.
Return value directly without saving it in a variable and remove that variable.

---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +1 -4
index 12661d7..ef5f78e 100644
@@ -353,10 +353,7 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
 
 int	rtw_init_mlme_priv(struct adapter *padapter)/* struct	mlme_priv *pmlmepriv) */
 {
-	int	res;
-
-	res = _rtw_init_mlme_priv(padapter);/*  (pmlmepriv); */
-	return res;
+	return _rtw_init_mlme_priv(padapter);
 }
 
 void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
Signature · 1 line
2.7.4
#6 lore raw

Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8723bs: core: rtw_mlme.c: Compress two lines into one line

Quoted 14 lines · Payal Kshirsagar

Challenge suggested by coccinelle.
Return value directly without saving it in a variable and remove that variable.

---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +0 -0
index 12661d7..ef5f78e 100644

drivers/staging/rtl8723bs/core/rtw_mlme.c u8 *rtw_get_beacon_interval_from_ie(u8 *ie) · line 356

Quoted 8 lines
drivers/staging/rtl8723bs/core/rtw_mlme.c +1 -4
@@ -353,10 +353,7 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
 
 int	rtw_init_mlme_priv(struct adapter *padapter)/* struct	mlme_priv *pmlmepriv) */
 {
-	int	res;
-
-	res = _rtw_init_mlme_priv(padapter);/*  (pmlmepriv); */
-	return res;
+	return _rtw_init_mlme_priv(padapter);

The code doesn't look like this any more. Please update your staging tree and start over with this patch series.

julia

Quoted 13 lines
drivers/staging/rtl8723bs/core/rtw_mlme.c +0 -1
 }
 
 void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
--

2.7.4

--
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/4756f370659f5e98dcd00f7dea94b062d202235a.1553955183.git.payal.s.kshirsagar.98%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#7 lore raw

Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8723bs: core: rtw_mlme.c: Compress two lines into one line

Quoted 29 lines · Julia Lawall

Review

Quoted 10 lines · Payal Kshirsagar

Challenge suggested by coccinelle.
Return value directly without saving it in a variable and remove that variable.

---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8723bs/core/rtw_mlme.c

drivers/staging/rtl8723bs/core/rtw_mlme.c u8 *rtw_get_beacon_interval_from_ie(u8 *ie) · line 354

Quoted 6 lines

index 12661d7..ef5f78e 100644

drivers/staging/rtl8723bs/core/rtw_mlme.c +0 -0
@@ -353,10 +353,7 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
 
 int  rtw_init_mlme_priv(struct adapter *padapter)/* struct   mlme_priv

*pmlmepriv) */

drivers/staging/rtl8723bs/core/rtw_mlme.c u8 *rtw_get_beacon_interval_from_ie(u8 *ie) · line 356

Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_mlme.c +1 -4
 {
-     int     res;
-
-     res = _rtw_init_mlme_priv(padapter);/*  (pmlmepriv); */
-     return res;
+     return _rtw_init_mlme_priv(padapter);
Quoted 3 lines

The code doesn't look like this any more. Please update your staging tree and start over with this patch series.

Okay I will.
thanks,
payal

Quoted 21 lines

julia

Quoted 8 lines
drivers/staging/rtl8723bs/core/rtw_mlme.c +0 -1
 }
 
 void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
--

2.7.4

--
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/4756f370659f5e98dcd00f7dea94b062d202235a.1553955183.git.payal.s.kshirsagar.98%40gmail.com
.

Quoted 2 lines

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