All of lore.kernel.org
 help / color / mirror / Atom feed
* [Outreachy kernel] [PATCH] staging: rtl8723bs: Compress two lines into one line
@ 2019-03-29 17:35 Payal Kshirsagar
  2019-03-29 18:45 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Payal Kshirsagar @ 2019-03-29 17:35 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.

This patch compress two lines into one line using following semantic patch:

@@
local idexpression ret;
expression e;
@@

-ret = e;
+return e;
-return ret;

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
diff -u -p a/hal/rtl8723b_rf6052.c b/hal/rtl8723b_rf6052.c
--- a/hal/rtl8723b_rf6052.c
+++ b/hal/rtl8723b_rf6052.c
@@ -208,8 +208,7 @@ int PHY_RF6052_Config8723B(struct adapte
 	/*  */
 	/*  Config BB and RF */
 	/*  */
-	rtStatus = phy_RF6052_Config_ParaFile(Adapter);
-	return rtStatus;
+	return phy_RF6052_Config_ParaFile(Adapter);
 
 }
 
diff -u -p a/hal/hal_btcoex.c b/hal/hal_btcoex.c
--- a/hal/hal_btcoex.c
+++ b/hal/hal_btcoex.c
@@ -351,9 +351,7 @@ static u32 halbtcoutsrc_GetWifiLinkStatu
 		numOfConnectedPort++;
 	}
 
-	retVal = (numOfConnectedPort << 16) | portConnectedStatus;
-
-	return retVal;
+	return (numOfConnectedPort << 16) | portConnectedStatus;
 }
 
 static u32 halbtcoutsrc_GetBtPatchVer(PBTC_COEXIST pBtCoexist)
@@ -369,9 +367,7 @@ static s32 halbtcoutsrc_GetWifiRssi(stru
 
 	pHalData = GET_HAL_DATA(padapter);
 
-	UndecoratedSmoothedPWDB = pHalData->dmpriv.EntryMinUndecoratedSmoothedPWDB;
-
-	return UndecoratedSmoothedPWDB;
+	return pHalData->dmpriv.EntryMinUndecoratedSmoothedPWDB;
 }
 
 static u8 halbtcoutsrc_GetWifiScanAPNum(struct adapter *padapter)
@@ -1698,8 +1694,5 @@ u32 hal_btcoex_GetDBG(struct adapter *pa
 	leftSize -= count;
 
 exit:
-	count = pstr - pStrBuf;
-/* 	DBG_871X(FUNC_ADPT_FMT ": usedsize =%d\n", FUNC_ADPT_ARG(padapter), count); */
-
-	return count;
+	return pstr - pStrBuf;
 }
diff -u -p a/hal/rtl8723b_phycfg.c b/hal/rtl8723b_phycfg.c
--- a/hal/rtl8723b_phycfg.c
+++ b/hal/rtl8723b_phycfg.c
@@ -68,9 +68,7 @@ u32 PHY_QueryBBReg_8723B(struct adapter
 
 	OriginalValue = rtw_read32(Adapter, RegAddr);
 	BitShift = phy_CalculateBitShift(BitMask);
-	ReturnValue = (OriginalValue & BitMask) >> BitShift;
-
-	return ReturnValue;
+	return (OriginalValue & BitMask) >> BitShift;
 
 }
 
@@ -293,9 +291,7 @@ u32 PHY_QueryRFReg_8723B(
 	Original_Value = phy_RFSerialRead_8723B(Adapter, eRFPath, RegAddr);
 
 	BitShift =  phy_CalculateBitShift(BitMask);
-	Readback_Value = (Original_Value & BitMask) >> BitShift;
-
-	return Readback_Value;
+	return (Original_Value & BitMask) >> BitShift;
 }
 
 /**
diff -u -p a/hal/odm_CfoTracking.c b/hal/odm_CfoTracking.c
--- a/hal/odm_CfoTracking.c
+++ b/hal/odm_CfoTracking.c
@@ -52,9 +52,7 @@ static u8 odm_GetDefaultCrytaltalCap(voi
 
 	CrystalCap = pHalData->CrystalCap;
 
-	CrystalCap = CrystalCap & 0x3f;
-
-	return CrystalCap;
+	return CrystalCap & 0x3f;
 }
 
 static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus)
@@ -79,12 +77,9 @@ static bool odm_GetATCStatus(void *pDM_V
 	bool ATCStatus;
 	PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
 
-	ATCStatus = (bool)PHY_QueryBBReg(
-		pDM_Odm->Adapter,
-		ODM_REG(BB_ATC, pDM_Odm),
-		ODM_BIT(BB_ATC, pDM_Odm)
-	);
-	return ATCStatus;
+	return (bool)PHY_QueryBBReg(pDM_Odm->Adapter,
+				    ODM_REG(BB_ATC, pDM_Odm),
+				    ODM_BIT(BB_ATC, pDM_Odm));
 }
 
 void ODM_CfoTrackingReset(void *pDM_VOID)
diff -u -p a/hal/hal_com.c b/hal/hal_com.c
--- a/hal/hal_com.c
+++ b/hal/hal_com.c
@@ -973,8 +973,7 @@ u8 rtw_get_mgntframe_raid(struct adapter
 {
 
 	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)
diff -u -p a/hal/hal_com_phycfg.c b/hal/hal_com_phycfg.c
--- a/hal/hal_com_phycfg.c
+++ b/hal/hal_com_phycfg.c
@@ -1498,9 +1498,7 @@ s8 PHY_GetTxPowerByRate(
 		return value;
 	}
 
-	value = pHalData->TxPwrByRateOffset[Band][RFPath][TxNum][rateIndex];
-
-	return value;
+	return pHalData->TxPwrByRateOffset[Band][RFPath][TxNum][rateIndex];
 
 }
 
diff -u -p a/core/rtw_efuse.c b/core/rtw_efuse.c
--- a/core/rtw_efuse.c
+++ b/core/rtw_efuse.c
@@ -127,9 +127,8 @@ Efuse_GetCurrentSize(
 {
 	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!!. */
@@ -253,8 +252,7 @@ u16 	Address)
 				break;
 			}
 		}
-		data = rtw_read8(Adapter, EFUSE_CTRL);
-		return data;
+		return rtw_read8(Adapter, EFUSE_CTRL);
 	} else
 		return 0xFF;
 
@@ -276,8 +274,7 @@ bool		bPseudoTest)
 	/* DBG_871X("===> EFUSE_OneByteRead() start, 0x34 = 0x%X\n", rtw_read32(padapter, EFUSE_TEST)); */
 
 	if (bPseudoTest) {
-		bResult = Efuse_Read1ByteFromFakeContent(padapter, addr, data);
-		return bResult;
+		return Efuse_Read1ByteFromFakeContent(padapter, addr, data);
 	}
 
 	/*  <20130121, Kordan> For SMIC EFUSE specificatoin. */
@@ -329,8 +326,7 @@ bool		bPseudoTest)
 	/* DBG_871X("===> EFUSE_OneByteWrite() start, 0x34 = 0x%X\n", rtw_read32(padapter, EFUSE_TEST)); */
 
 	if (bPseudoTest) {
-		bResult = Efuse_Write1ByteToFakeContent(padapter, addr, data);
-		return bResult;
+		return Efuse_Write1ByteToFakeContent(padapter, addr, data);
 	}
 
 
@@ -380,9 +376,8 @@ Efuse_PgPacketRead(struct adapter *padap
 {
 	int	ret = 0;
 
-	ret =  padapter->HalFunc.Efuse_PgPacketRead(padapter, offset, data, bPseudoTest);
-
-	return ret;
+	return padapter->HalFunc.Efuse_PgPacketRead(padapter, offset, data,
+						    bPseudoTest);
 }
 
 int
@@ -394,9 +389,9 @@ Efuse_PgPacketWrite(struct adapter *pada
 {
 	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);
 }
 
 /*-----------------------------------------------------------------------------
@@ -449,9 +444,10 @@ Efuse_WordEnableDataWrite(struct adapter
 {
 	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);
 }
 
 /*-----------------------------------------------------------------------------
diff -u -p a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c
--- a/core/rtw_pwrctrl.c
+++ b/core/rtw_pwrctrl.c
@@ -1403,7 +1403,5 @@ u32 rtw_ps_deny_get(struct adapter *pada
 	u32 deny;
 
 
-	deny = adapter_to_pwrctl(padapter)->ps_deny;
-
-	return deny;
+	return adapter_to_pwrctl(padapter)->ps_deny;
 }
diff -u -p a/core/rtw_io.c b/core/rtw_io.c
--- a/core/rtw_io.c
+++ b/core/rtw_io.c
@@ -45,8 +45,7 @@ u8 _rtw_read8(struct adapter *adapter, u
 
 	_read8 = pintfhdl->io_ops._read8;
 
-	r_val = _read8(pintfhdl, addr);
-	return r_val;
+	return _read8(pintfhdl, addr);
 }
 
 u16 _rtw_read16(struct adapter *adapter, u32 addr)
@@ -146,9 +145,7 @@ u32 _rtw_write_port(struct adapter *adap
 
 	_write_port = pintfhdl->io_ops._write_port;
 
-	ret = _write_port(pintfhdl, addr, cnt, pmem);
-
-	return ret;
+	return _write_port(pintfhdl, addr, cnt, pmem);
 }
 
 int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapter *padapter, struct _io_ops *pops))
diff -u -p a/core/rtw_mlme.c b/core/rtw_mlme.c
--- a/core/rtw_mlme.c
+++ b/core/rtw_mlme.c
@@ -355,8 +355,7 @@ int	rtw_init_mlme_priv(struct adapter *p
 {
 	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)
@@ -380,8 +379,7 @@ struct	wlan_network *rtw_alloc_network(s
 {
 	struct	wlan_network	*pnetwork;
 
-	pnetwork = _rtw_alloc_network(pmlmepriv);
-	return pnetwork;
+	return _rtw_alloc_network(pmlmepriv);
 }
 
 void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork);
diff -u -p a/core/rtw_btcoex.c b/core/rtw_btcoex.c
--- a/core/rtw_btcoex.c
+++ b/core/rtw_btcoex.c
@@ -108,9 +108,7 @@ s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(str
 {
 	s32 coexctrl;
 
-	coexctrl = hal_btcoex_IsBTCoexCtrlAMPDUSize(padapter);
-
-	return coexctrl;
+	return hal_btcoex_IsBTCoexCtrlAMPDUSize(padapter);
 }
 
 void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)
diff -u -p a/core/rtw_recv.c b/core/rtw_recv.c
--- a/core/rtw_recv.c
+++ b/core/rtw_recv.c
@@ -2390,8 +2390,7 @@ int process_recv_indicatepkts(struct ada
 
 			if ((padapter->bDriverStopped == false) &&
 			    (padapter->bSurpriseRemoved == false)) {
-				retval = _FAIL;
-				return retval;
+				return _FAIL;
 			}
 		}
 	} else { /* B/G mode */
@@ -2414,8 +2413,7 @@ int process_recv_indicatepkts(struct ada
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("@@@@ process_recv_indicatepkts- recv_func free_indicatepkt\n"));
 
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("recv_func:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved));
-			retval = _FAIL;
-			return retval;
+			return _FAIL;
 		}
 
 	}
diff -u -p a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c
--- a/core/rtw_mlme_ext.c
+++ b/core/rtw_mlme_ext.c
@@ -3581,9 +3581,7 @@ s32 issue_nulldata_in_interrupt(struct a
 	if (da == NULL)
 		da = get_my_bssid(&(pmlmeinfo->network));
 
-	ret = _issue_nulldata(padapter, da, 0, false);
-
-	return ret;
+	return _issue_nulldata(padapter, da, 0, false);
 }
 
 /* when wait_ack is ture, this function shoule be called at process context */
diff -u -p a/core/rtw_cmd.c b/core/rtw_cmd.c
--- a/core/rtw_cmd.c
+++ b/core/rtw_cmd.c
@@ -299,16 +299,14 @@ u32 rtw_init_cmd_priv(struct cmd_priv *p
 {
 	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)
@@ -377,9 +375,7 @@ struct	cmd_obj	*rtw_dequeue_cmd(struct c
 {
 	struct cmd_obj *cmd_obj;
 
-	cmd_obj = _rtw_dequeue_cmd(&pcmdpriv->cmd_queue);
-
-	return cmd_obj;
+	return _rtw_dequeue_cmd(&pcmdpriv->cmd_queue);
 }
 
 void rtw_free_cmd_obj(struct cmd_obj *pcmd)
diff -u -p a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c
--- a/core/rtw_sta_mgt.c
+++ b/core/rtw_sta_mgt.c
@@ -204,8 +204,7 @@ struct	sta_info *rtw_alloc_stainfo(struc
 	if (list_empty(&pfree_sta_queue->queue)) {
 		/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
 		spin_unlock_bh(&(pstapriv->sta_hash_lock));
-		psta = NULL;
-		return psta;
+		return NULL;
 	} else {
 		psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
 
@@ -590,8 +589,7 @@ struct sta_info *rtw_get_bcmc_stainfo(st
 	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)
diff -u -p a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c
--- a/os_dep/ioctl_cfg80211.c
+++ b/os_dep/ioctl_cfg80211.c
@@ -2525,9 +2525,7 @@ static netdev_tx_t rtw_cfg80211_monitor_
 		DBG_8192C("should be eapol packet\n");
 
 		/* Use the real net device to transmit the packet */
-		ret = _rtw_xmit_entry(skb, padapter->pnetdev);
-
-		return ret;
+		return _rtw_xmit_entry(skb, padapter->pnetdev);
 
 	}
 	else if ((frame_control & (IEEE80211_FCTL_FTYPE|IEEE80211_FCTL_STYPE))
@@ -2849,9 +2847,8 @@ static int cfg80211_rtw_change_beacon(st
 
 	DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
 
-	ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
-
-	return ret;
+	return rtw_add_beacon(adapter, info->head, info->head_len, info->tail,
+			      info->tail_len);
 }
 
 static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
@@ -2896,9 +2893,7 @@ static int cfg80211_rtw_del_station(stru
 
 		flush_all_cam_entry(padapter);	/* clear CAM */
 
-		ret = rtw_sta_flush(padapter);
-
-		return ret;
+		return rtw_sta_flush(padapter);
 	}
 
 
diff -u -p a/os_dep/rtw_proc.c b/os_dep/rtw_proc.c
--- a/os_dep/rtw_proc.c
+++ b/os_dep/rtw_proc.c
@@ -21,9 +21,7 @@ inline struct proc_dir_entry *rtw_proc_c
 {
 	struct proc_dir_entry *entry;
 
-	entry = proc_mkdir_data(name, S_IRUGO|S_IXUGO, parent, data);
-
-	return entry;
+	return proc_mkdir_data(name, S_IRUGO | S_IXUGO, parent, data);
 }
 
 inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent,
@@ -31,9 +29,7 @@ inline struct proc_dir_entry *rtw_proc_c
 {
 	struct proc_dir_entry *entry;
 
-	entry = proc_create_data(name,  S_IFREG|S_IRUGO, parent, fops, data);
-
-	return entry;
+	return proc_create_data(name, S_IFREG | S_IRUGO, parent, fops, data);
 }
 
 static int proc_get_dummy(struct seq_file *m, void *v)


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

* Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Compress two lines into one line
  2019-03-29 17:35 [Outreachy kernel] [PATCH] staging: rtl8723bs: Compress two lines into one line Payal Kshirsagar
@ 2019-03-29 18:45 ` Greg KH
  2019-03-29 18:48   ` Payal Kshirsagar
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2019-03-29 18:45 UTC (permalink / raw)
  To: Payal Kshirsagar; +Cc: outreachy-kernel

On Fri, Mar 29, 2019 at 11:05:17PM +0530, Payal Kshirsagar wrote:
> Challenge suggested by coccinelle.
> 
> This patch compress two lines into one line using following semantic patch:
> 
> @@
> local idexpression ret;
> expression e;
> @@
> 
> -ret = e;
> +return e;
> -return ret;
> 
> Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
> ---
> diff -u -p a/hal/rtl8723b_rf6052.c b/hal/rtl8723b_rf6052.c
> --- a/hal/rtl8723b_rf6052.c
> +++ b/hal/rtl8723b_rf6052.c

Please take your patch and try to apply it yourself to a kernel git
tree.

Hint, it will not work :(

Always test your patches before sending them out.

greg k-h


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

* Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Compress two lines into one line
  2019-03-29 18:45 ` Greg KH
@ 2019-03-29 18:48   ` Payal Kshirsagar
  0 siblings, 0 replies; 3+ messages in thread
From: Payal Kshirsagar @ 2019-03-29 18:48 UTC (permalink / raw)
  To: Greg KH; +Cc: outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

On Sat, Mar 30, 2019, 12:15 AM Greg KH <greg@kroah.com> wrote:

> On Fri, Mar 29, 2019 at 11:05:17PM +0530, Payal Kshirsagar wrote:
> > Challenge suggested by coccinelle.
> >
> > This patch compress two lines into one line using following semantic
> patch:
> >
> > @@
> > local idexpression ret;
> > expression e;
> > @@
> >
> > -ret = e;
> > +return e;
> > -return ret;
> >
> > Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
> > ---
> > diff -u -p a/hal/rtl8723b_rf6052.c b/hal/rtl8723b_rf6052.c
> > --- a/hal/rtl8723b_rf6052.c
> > +++ b/hal/rtl8723b_rf6052.c
>
> Please take your patch and try to apply it yourself to a kernel git
> tree.
>

I will try and sorry for the inconvenience.
Thanks,
Payal

Hint, it will not work :(
>
> Always test your patches before sending them out.
>
> greg k-h
>

[-- Attachment #2: Type: text/html, Size: 1582 bytes --]

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

end of thread, other threads:[~2019-03-29 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 17:35 [Outreachy kernel] [PATCH] staging: rtl8723bs: Compress two lines into one line Payal Kshirsagar
2019-03-29 18:45 ` Greg KH
2019-03-29 18:48   ` Payal Kshirsagar

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.