drivers/staging: drivers/staging: Remove useless return variables
Subsystems (2)
PATCH v3 1/1 drivers/staging: drivers/staging: Remove useless return variables
This patch remove variables that are initialized with a constant, are never updated, and are only used as parameter of return. Return the constant instead of using a variable.
Verified by compilation only.
The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
when strict
return
- ret
+ C
;
// </smpl>
Signed-off-by Peter Senna Tschudin <[email protected]>
---
Changes from V2:
- Refreshed for staging/staging-next
drivers/staging/bcm/Bcmchar.c | 3 +-- drivers/staging/bcm/InterfaceIdleMode.c | 3 +-- drivers/staging/bcm/PHSModule.c | 9 +++------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 3 +-- drivers/staging/rtl8192e/rtllib_rx.c | 3 +-- drivers/staging/rtl8192e/rtllib_softmac.c | 3 +-- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 +--- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 3 +-- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 3 +-- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +--- drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 3 +-- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 3 +-- drivers/staging/rtl8192u/r819xU_phy.c | 3 +-- drivers/staging/sep/sep_main.c | 3 +-- drivers/staging/silicom/bpctl_mod.c | 4 ++-- drivers/staging/wlan-ng/hfa384x_usb.c | 3 +-- drivers/staging/wlan-ng/p80211req.c | 3 +-- 17 files changed, 20 insertions(+), 40 deletions(-)
drivers/staging/bcm/Bcmchar.c +1 -2
@@ -1849,7 +1849,6 @@ static int bcm_char_ioctl_flash2x_section_bitmap(void __user *argp, {struct bcm_flash2x_bitmap *psFlash2xBitMap;struct bcm_ioctl_buffer IoBuffer; -INT Status =STATUS_FAILURE ;BCM_DEBUG_PRINT (Adapter,DBG_TYPE_OTHERS ,OSAL_DBG ,DBG_LVL_ALL ,"IOCTL_BCM_GET_FLASH2X_SECTION_BITMAP Called" );
@@ -1892,7 +1891,7 @@ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, }kfree (psFlash2xBitMap); -return Status; +return STATUS_FAILURE ; } static int bcm_char_ioctl_set_active_section(void __user *argp,
drivers/staging/bcm/InterfaceIdleMode.c +1 -2
@@ -223,7 +223,6 @@ static int InterfaceAbortIdlemode(struct bcm_mini_adapter *Adapter, }int InterfaceIdleModeWakeup (struct bcm_mini_adapter *Adapter) { -ULONG Status =0 ;if (Adapter->bTriedToWakeUpFromlowPowerMode) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, DBG_LVL_ALL,
@@ -233,7 +232,7 @@ int InterfaceIdleModeWakeup(struct bcm_mini_adapter *Adapter)InterfaceAbortIdlemode (Adapter, Adapter->usIdleModePattern); } -return Status; +return 0 ; }void InterfaceHandleShutdownModeWakeup (struct bcm_mini_adapter *Adapter)
drivers/staging/bcm/PHSModule.c +3 -6
@@ -409,7 +409,6 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext,*/ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI) { -ULONG lStatus =0 ;UINT nSFIndex =0 , nClsidIndex =0 ;struct bcm_phs_entry *pstServiceFlowEntry =NULL ;struct bcm_phs_classifier_table *pstClassifierRulesTable =NULL ;
@@ -446,7 +445,7 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI } } } -return lStatus; +return 0 ; }/*
@@ -467,7 +466,6 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI*/ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT16 uiClsId) { -ULONG lStatus =0 ;UINT nSFIndex =0 , nClsidIndex =0 ;struct bcm_phs_entry *pstServiceFlowEntry =NULL ;struct bcm_phs_classifier_entry *pstClassifierEntry =NULL ;
@@ -504,7 +502,7 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1memset (pstClassifierEntry,0 ,sizeof (struct bcm_phs_classifier_entry )); } } -return lStatus; +return 0 ; }/*
@@ -524,7 +522,6 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1*/ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) { -ULONG lStatus =0 ;UINT nSFIndex =0 , nClsidIndex =0 ;struct bcm_phs_entry *pstServiceFlowEntry =NULL ;struct bcm_phs_classifier_table *pstClassifierRulesTable =NULL ;
@@ -573,7 +570,7 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) pstServiceFlowEntry->uiVcid =0 ; } -return lStatus; +return 0 ; }/*
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +1 -2
@@ -729,7 +729,6 @@ u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, {int i; -u8 ret =0 ;switch (eRFPath) {case RF90_PATH_A :
@@ -787,7 +786,7 @@ u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev,break ; } -return ret; +return 0 ; }static void rtl8192_SetTxPowerLevel (struct net_device *dev,u8 channel)
drivers/staging/rtl8192e/rtllib_rx.c +1 -2
@@ -1589,7 +1589,6 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info {struct rtllib_qos_ac_parameter *ac_params;struct rtllib_qos_parameters *qos_param = &(qos_data->parameters); -int rc =0 ;int i;u8 aci;u8 acm;
@@ -1640,7 +1639,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info (ac_params->aci_aifsn &0x10 ) ?0x01 :0x00 ; qos_param->tx_op_limit[aci] = ac_params->tx_op_limit; } -return rc; +return 0 ; }/*
drivers/staging/rtl8192e/rtllib_softmac.c +1 -2
@@ -3239,7 +3239,6 @@ static int rtllib_wpa_set_auth_algs(struct rtllib_device *ieee, int value)struct rtllib_security sec = { .flags =SEC_AUTH_MODE , }; -int ret =0 ;if (value &AUTH_ALG_SHARED_KEY ) { sec.auth_mode =WLAN_AUTH_SHARED_KEY ;
@@ -3259,7 +3258,7 @@ static int rtllib_wpa_set_auth_algs(struct rtllib_device *ieee, int value)if (ieee->set_security) ieee->set_security (ieee->dev, &sec); -return ret; +return 0 ; }static int rtllib_wpa_set_param (struct rtllib_device *ieee,u8 name,u32 value)
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1 -3
@@ -628,8 +628,6 @@ int rtllib_wx_get_power(struct rtllib_device *ieee,struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; - down(&ieee->wx_sem);if (ieee->ps =RTLLIB_PS_DISABLED ) {
@@ -657,7 +655,7 @@ int rtllib_wx_get_power(struct rtllib_device *ieee, exit:up (&ieee->wx_sem); -return ret; +return 0 ; }EXPORT_SYMBOL (rtllib_wx_get_power);
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +1 -2
@@ -1477,7 +1477,6 @@ static int ieee80211_qos_convert_ac_to_parameters(structieee80211_qos_parameters *qos_param) { -int rc =0 ;int i;struct ieee80211_qos_ac_parameter *ac_params;u8 aci;
@@ -1504,7 +1503,7 @@ static int ieee80211_qos_convert_ac_to_parameters(struct (ac_params->aci_aifsn &0x10 ) ?0x01 :0x00 ; qos_param->tx_op_limit[aci] =le16_to_cpu (ac_params->tx_op_limit); } -return rc; +return 0 ; }/*
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +1 -2
@@ -2854,7 +2854,6 @@ static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)struct ieee80211_security sec = { .flags =SEC_AUTH_MODE , }; -int ret =0 ;if (value &AUTH_ALG_SHARED_KEY ) { sec.auth_mode =WLAN_AUTH_SHARED_KEY ;
@@ -2877,7 +2876,7 @@ static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)//else // ret = -EOPNOTSUPP; -return ret; +return 0 ; }static int ieee80211_wpa_set_param (struct ieee80211_device *ieee,u8 name,u32 value)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +1 -3
@@ -570,8 +570,6 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee,struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret =0; - down(&ieee->wx_sem);if (ieee->ps =IEEE80211_PS_DISABLED ){
@@ -601,7 +599,7 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee, exit:up (&ieee->wx_sem); -return ret; +return 0 ; }EXPORT_SYMBOL (ieee80211_wx_get_power);
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +1 -2
@@ -415,8 +415,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device *ieee)* *****************************************************************************************************************/ static u8 HTIOTActIsDisableMCS14 (struct ieee80211_device *ieee,u8 *PeerMacAddr) { -u8 ret =0 ; -return ret; +return 0 ; }
drivers/staging/rtl8192u/r819xU_cmdpkt.c +1 -2
@@ -28,7 +28,6 @@rt_status SendTxCommandPacket (struct net_device *dev,void *pData,u32 DataLen) { -rt_status rtStatus =RT_STATUS_SUCCESS ;struct r8192_priv *priv =ieee80211_priv (dev);struct sk_buff *skb;cb_desc *tcb_desc;
@@ -58,7 +57,7 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) priv->ieee80211->softmac_hard_start_xmit (skb, dev); } -return rtStatus; +return RT_STATUS_SUCCESS ; }/*-----------------------------------------------------------------------------
drivers/staging/rtl8192u/r819xU_phy.c +1 -2
@@ -991,7 +991,6 @@ u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, {int i; -u8 ret =0 ;switch (eRFPath) {case RF90_PATH_A :
@@ -1058,7 +1057,7 @@ u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev,break ; } -return ret; +return 0 ; }
drivers/staging/sep/sep_main.c +1 -2
@@ -1400,7 +1400,6 @@ static int sep_lli_table_secure_dma(struct sep_device *sep, struct sep_dma_context *dma_ctx) { -int error =0 ;u32 count;/* The the page of the end address of the user space buffer */ u32 end_page;
@@ -1491,7 +1490,7 @@ static int sep_lli_table_secure_dma(struct sep_device *sep, dma_ctx->dma_res_arr[dma_ctx->nr_dcb_creat].out_map_array =NULL ; dma_ctx->dma_res_arr[dma_ctx->nr_dcb_creat].out_map_num_entries =0 ; -return error; +return 0 ; }/**
drivers/staging/silicom/bpctl_mod.c +2 -2
@@ -1562,7 +1562,7 @@ int pulse_set_fn(struct bpctl_dev *pbpctl_dev, unsigned int counter)int zero_set_fn (struct bpctl_dev *pbpctl_dev) { -uint32_t ctrl_ext =0 , ctrl_value =0 ; +uint32_t ctrl_ext =0 ;if (!pbpctl_dev)return -1 ;
@@ -1582,7 +1582,7 @@ int zero_set_fn(struct bpctl_dev *pbpctl_dev) BPCTLI_CTRL_EXT_MDIO_DATA))); } -return ctrl_value; +return 0 ; }int pulse_get2_fn (struct bpctl_dev *pbpctl_dev)
drivers/staging/wlan-ng/hfa384x_usb.c +1 -2
@@ -2642,7 +2642,6 @@ done:----------------------------------------------------------------*/ int hfa384x_drvr_stop (hfa384x_t *hw) { -int result =0 ;int i;might_sleep ();
@@ -2667,7 +2666,7 @@ int hfa384x_drvr_stop(hfa384x_t *hw)for (i =0 ; i < HFA384x_NUMPORTS_MAX; i++) hw->port_enabled[i] =0 ; -return result; +return 0 ; }/*----------------------------------------------------------------
drivers/staging/wlan-ng/p80211req.c +1 -2
@@ -95,7 +95,6 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev,----------------------------------------------------------------*/ int p80211req_dorequest (wlandevice_t *wlandev,u8 *msgbuf) { -int result =0 ;struct p80211msg *msg = (struct p80211msg *) msgbuf;/* Check to make sure the MSD is running */
@@ -129,7 +128,7 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf) wlandev->mlmerequest (wlandev, msg);clear_bit (1 , &(wlandev->request_pending)); -return result;/* if result=0, msg->status still may contain an err */ +return 0 ;/* if result=0, msg->status still may contain an err */ }/*----------------------------------------------------------------