Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Senna Tschudin and committed by
Greg Kroah-Hartman
4764ca98 9c73b46a

+20 -40
+1 -2
drivers/staging/bcm/Bcmchar.c
··· 1849 1849 { 1850 1850 struct bcm_flash2x_bitmap *psFlash2xBitMap; 1851 1851 struct bcm_ioctl_buffer IoBuffer; 1852 - INT Status = STATUS_FAILURE; 1853 1852 1854 1853 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, 1855 1854 "IOCTL_BCM_GET_FLASH2X_SECTION_BITMAP Called"); ··· 1891 1892 } 1892 1893 1893 1894 kfree(psFlash2xBitMap); 1894 - return Status; 1895 + return STATUS_FAILURE; 1895 1896 } 1896 1897 1897 1898 static int bcm_char_ioctl_set_active_section(void __user *argp,
+1 -2
drivers/staging/bcm/InterfaceIdleMode.c
··· 223 223 } 224 224 int InterfaceIdleModeWakeup(struct bcm_mini_adapter *Adapter) 225 225 { 226 - ULONG Status = 0; 227 226 if (Adapter->bTriedToWakeUpFromlowPowerMode) { 228 227 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, 229 228 IDLE_MODE, DBG_LVL_ALL, ··· 232 233 InterfaceAbortIdlemode(Adapter, Adapter->usIdleModePattern); 233 234 234 235 } 235 - return Status; 236 + return 0; 236 237 } 237 238 238 239 void InterfaceHandleShutdownModeWakeup(struct bcm_mini_adapter *Adapter)
+3 -6
drivers/staging/bcm/PHSModule.c
··· 409 409 */ 410 410 ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI) 411 411 { 412 - ULONG lStatus = 0; 413 412 UINT nSFIndex = 0, nClsidIndex = 0; 414 413 struct bcm_phs_entry *pstServiceFlowEntry = NULL; 415 414 struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL; ··· 445 446 } 446 447 } 447 448 } 448 - return lStatus; 449 + return 0; 449 450 } 450 451 451 452 /* ··· 466 467 */ 467 468 ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT16 uiClsId) 468 469 { 469 - ULONG lStatus = 0; 470 470 UINT nSFIndex = 0, nClsidIndex = 0; 471 471 struct bcm_phs_entry *pstServiceFlowEntry = NULL; 472 472 struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; ··· 502 504 memset(pstClassifierEntry, 0, sizeof(struct bcm_phs_classifier_entry)); 503 505 } 504 506 } 505 - return lStatus; 507 + return 0; 506 508 } 507 509 508 510 /* ··· 522 524 */ 523 525 ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) 524 526 { 525 - ULONG lStatus = 0; 526 527 UINT nSFIndex = 0, nClsidIndex = 0; 527 528 struct bcm_phs_entry *pstServiceFlowEntry = NULL; 528 529 struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL; ··· 570 573 pstServiceFlowEntry->uiVcid = 0; 571 574 } 572 575 573 - return lStatus; 576 + return 0; 574 577 } 575 578 576 579 /*
+1 -2
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
··· 729 729 { 730 730 731 731 int i; 732 - u8 ret = 0; 733 732 734 733 switch (eRFPath) { 735 734 case RF90_PATH_A: ··· 786 787 break; 787 788 } 788 789 789 - return ret; 790 + return 0; 790 791 791 792 } 792 793 static void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel)
+1 -2
drivers/staging/rtl8192e/rtllib_rx.c
··· 1589 1589 { 1590 1590 struct rtllib_qos_ac_parameter *ac_params; 1591 1591 struct rtllib_qos_parameters *qos_param = &(qos_data->parameters); 1592 - int rc = 0; 1593 1592 int i; 1594 1593 u8 aci; 1595 1594 u8 acm; ··· 1639 1640 (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; 1640 1641 qos_param->tx_op_limit[aci] = ac_params->tx_op_limit; 1641 1642 } 1642 - return rc; 1643 + return 0; 1643 1644 } 1644 1645 1645 1646 /*
+1 -2
drivers/staging/rtl8192e/rtllib_softmac.c
··· 3239 3239 struct rtllib_security sec = { 3240 3240 .flags = SEC_AUTH_MODE, 3241 3241 }; 3242 - int ret = 0; 3243 3242 3244 3243 if (value & AUTH_ALG_SHARED_KEY) { 3245 3244 sec.auth_mode = WLAN_AUTH_SHARED_KEY; ··· 3258 3259 if (ieee->set_security) 3259 3260 ieee->set_security(ieee->dev, &sec); 3260 3261 3261 - return ret; 3262 + return 0; 3262 3263 } 3263 3264 3264 3265 static int rtllib_wpa_set_param(struct rtllib_device *ieee, u8 name, u32 value)
+1 -3
drivers/staging/rtl8192e/rtllib_softmac_wx.c
··· 628 628 struct iw_request_info *info, 629 629 union iwreq_data *wrqu, char *extra) 630 630 { 631 - int ret = 0; 632 - 633 631 down(&ieee->wx_sem); 634 632 635 633 if (ieee->ps == RTLLIB_PS_DISABLED) { ··· 655 657 656 658 exit: 657 659 up(&ieee->wx_sem); 658 - return ret; 660 + return 0; 659 661 660 662 } 661 663 EXPORT_SYMBOL(rtllib_wx_get_power);
+1 -2
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
··· 1477 1477 ieee80211_qos_parameters 1478 1478 *qos_param) 1479 1479 { 1480 - int rc = 0; 1481 1480 int i; 1482 1481 struct ieee80211_qos_ac_parameter *ac_params; 1483 1482 u8 aci; ··· 1503 1504 (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; 1504 1505 qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit); 1505 1506 } 1506 - return rc; 1507 + return 0; 1507 1508 } 1508 1509 1509 1510 /*
+1 -2
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
··· 2854 2854 struct ieee80211_security sec = { 2855 2855 .flags = SEC_AUTH_MODE, 2856 2856 }; 2857 - int ret = 0; 2858 2857 2859 2858 if (value & AUTH_ALG_SHARED_KEY) { 2860 2859 sec.auth_mode = WLAN_AUTH_SHARED_KEY; ··· 2876 2877 //else 2877 2878 // ret = -EOPNOTSUPP; 2878 2879 2879 - return ret; 2880 + return 0; 2880 2881 } 2881 2882 2882 2883 static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+1 -3
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
··· 570 570 struct iw_request_info *info, 571 571 union iwreq_data *wrqu, char *extra) 572 572 { 573 - int ret =0; 574 - 575 573 down(&ieee->wx_sem); 576 574 577 575 if(ieee->ps == IEEE80211_PS_DISABLED){ ··· 599 601 600 602 exit: 601 603 up(&ieee->wx_sem); 602 - return ret; 604 + return 0; 603 605 604 606 } 605 607 EXPORT_SYMBOL(ieee80211_wx_get_power);
+1 -2
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
··· 415 415 * *****************************************************************************************************************/ 416 416 static u8 HTIOTActIsDisableMCS14(struct ieee80211_device *ieee, u8 *PeerMacAddr) 417 417 { 418 - u8 ret = 0; 419 - return ret; 418 + return 0; 420 419 } 421 420 422 421
+1 -2
drivers/staging/rtl8192u/r819xU_cmdpkt.c
··· 28 28 29 29 rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) 30 30 { 31 - rt_status rtStatus = RT_STATUS_SUCCESS; 32 31 struct r8192_priv *priv = ieee80211_priv(dev); 33 32 struct sk_buff *skb; 34 33 cb_desc *tcb_desc; ··· 57 58 priv->ieee80211->softmac_hard_start_xmit(skb, dev); 58 59 } 59 60 60 - return rtStatus; 61 + return RT_STATUS_SUCCESS; 61 62 } 62 63 63 64 /*-----------------------------------------------------------------------------
+1 -2
drivers/staging/rtl8192u/r819xU_phy.c
··· 991 991 { 992 992 993 993 int i; 994 - u8 ret = 0; 995 994 996 995 switch (eRFPath) { 997 996 case RF90_PATH_A: ··· 1057 1058 break; 1058 1059 } 1059 1060 1060 - return ret; 1061 + return 0; 1061 1062 1062 1063 } 1063 1064
+1 -2
drivers/staging/sep/sep_main.c
··· 1400 1400 struct sep_dma_context *dma_ctx) 1401 1401 1402 1402 { 1403 - int error = 0; 1404 1403 u32 count; 1405 1404 /* The the page of the end address of the user space buffer */ 1406 1405 u32 end_page; ··· 1490 1491 dma_ctx->dma_res_arr[dma_ctx->nr_dcb_creat].out_map_array = NULL; 1491 1492 dma_ctx->dma_res_arr[dma_ctx->nr_dcb_creat].out_map_num_entries = 0; 1492 1493 1493 - return error; 1494 + return 0; 1494 1495 } 1495 1496 1496 1497 /**
+2 -2
drivers/staging/silicom/bpctl_mod.c
··· 1564 1564 1565 1565 int zero_set_fn(struct bpctl_dev *pbpctl_dev) 1566 1566 { 1567 - uint32_t ctrl_ext = 0, ctrl_value = 0; 1567 + uint32_t ctrl_ext = 0; 1568 1568 1569 1569 if (!pbpctl_dev) 1570 1570 return -1; ··· 1585 1585 BPCTLI_CTRL_EXT_MDIO_DATA))); 1586 1586 1587 1587 } 1588 - return ctrl_value; 1588 + return 0; 1589 1589 } 1590 1590 1591 1591 int pulse_get2_fn(struct bpctl_dev *pbpctl_dev)
+1 -2
drivers/staging/wlan-ng/hfa384x_usb.c
··· 2642 2642 ----------------------------------------------------------------*/ 2643 2643 int hfa384x_drvr_stop(hfa384x_t *hw) 2644 2644 { 2645 - int result = 0; 2646 2645 int i; 2647 2646 2648 2647 might_sleep(); ··· 2666 2667 for (i = 0; i < HFA384x_NUMPORTS_MAX; i++) 2667 2668 hw->port_enabled[i] = 0; 2668 2669 2669 - return result; 2670 + return 0; 2670 2671 } 2671 2672 2672 2673 /*----------------------------------------------------------------
+1 -2
drivers/staging/wlan-ng/p80211req.c
··· 95 95 ----------------------------------------------------------------*/ 96 96 int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf) 97 97 { 98 - int result = 0; 99 98 struct p80211msg *msg = (struct p80211msg *) msgbuf; 100 99 101 100 /* Check to make sure the MSD is running */ ··· 128 129 wlandev->mlmerequest(wlandev, msg); 129 130 130 131 clear_bit(1, &(wlandev->request_pending)); 131 - return result; /* if result==0, msg->status still may contain an err */ 132 + return 0; /* if result==0, msg->status still may contain an err */ 132 133 } 133 134 134 135 /*----------------------------------------------------------------