OSDN Git Service

drivers/staging: Remove useless return variables
authorPeter Senna Tschudin <peter.senna@gmail.com>
Mon, 26 May 2014 14:08:50 +0000 (16:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 May 2014 17:32:15 +0000 (10:32 -0700)
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 <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 files changed:
drivers/staging/bcm/Bcmchar.c
drivers/staging/bcm/InterfaceIdleMode.c
drivers/staging/bcm/PHSModule.c
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
drivers/staging/rtl8192e/rtllib_rx.c
drivers/staging/rtl8192e/rtllib_softmac.c
drivers/staging/rtl8192e/rtllib_softmac_wx.c
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
drivers/staging/rtl8192u/r819xU_cmdpkt.c
drivers/staging/rtl8192u/r819xU_phy.c
drivers/staging/sep/sep_main.c
drivers/staging/silicom/bpctl_mod.c
drivers/staging/wlan-ng/hfa384x_usb.c
drivers/staging/wlan-ng/p80211req.c

index 52809dc..606d5f5 100644 (file)
@@ -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,
index fecf81f..c84ee49 100644 (file)
@@ -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)
index afc7bcc..07c5a0b 100644 (file)
@@ -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_UINT1
                        memset(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;
 }
 
 /*
index b4bfafe..8848921 100644 (file)
@@ -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)
index 7413816..60de54c 100644 (file)
@@ -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;
 }
 
 /*
index d65cba4..684ceed 100644 (file)
@@ -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)
index e6af8cf..65b650c 100644 (file)
@@ -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);
index 0cd6a00..d9a8299 100644 (file)
@@ -1477,7 +1477,6 @@ static int ieee80211_qos_convert_ac_to_parameters(struct
                                                  ieee80211_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;
 }
 
 /*
index 5274ff0..c5a0a5d 100644 (file)
@@ -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)
index a381768..935a8f4 100644 (file)
@@ -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);
index e7c54ac..2694a08 100644 (file)
@@ -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;
  }
 
 
index 723c863..545f49e 100644 (file)
@@ -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;
 }
 
 /*-----------------------------------------------------------------------------
index 87e07ba..02554c9 100644 (file)
@@ -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;
 
 }
 
index e301207..75ca15e 100644 (file)
@@ -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;
 }
 
 /**
index 22bf4bf..f74b5e7 100644 (file)
@@ -1564,7 +1564,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;
@@ -1585,7 +1585,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)
index f0ab5a2..98343ff 100644 (file)
@@ -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;
 }
 
 /*----------------------------------------------------------------
index 9779574..7221379 100644 (file)
@@ -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 */
 }
 
 /*----------------------------------------------------------------