2019-05-19 17:02:19

by Hariprasad Kelam

[permalink] [raw]
Subject: [PATCH] staging: rtl8723bs: os_dep: os_intfs: fix warning Unneeded variable: "status". Return "_SUCCESS"

This patch fixes below warnings reported by coccicheck

drivers/staging/rtl8723bs/os_dep/os_intfs.c:228:6-12: Unneeded variable:
"status". Return "_SUCCESS" on line 333
drivers/staging/rtl8723bs/os_dep/os_intfs.c:607:4-7: Unneeded variable:
"ret". Return "_SUCCESS" on line 669
drivers/staging/rtl8723bs/os_dep/os_intfs.c:713:4-8: Unneeded variable:
"ret8". Return "_SUCCESS" on line 743
drivers/staging/rtl8723bs/os_dep/os_intfs.c:1379:5-8: Unneeded variable:
"ret". Return "_SUCCESS" on line 1421
drivers/staging/rtl8723bs/os_dep/os_intfs.c:1429:5-8: Unneeded variable:
"ret". Return "_SUCCESS" on line 1451
drivers/staging/rtl8723bs/os_dep/os_intfs.c:1300:5-8: Unneeded variable:
"ret". Return "_SUCCESS" on line 1368

Signed-off-by: Hariprasad Kelam <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 8a9d838..71dfac5 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -225,7 +225,6 @@ static int netdev_close (struct net_device *pnetdev);

static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev)
{
- uint status = _SUCCESS;
struct registry_priv *registry_par = &padapter->registrypriv;

registry_par->chip_version = (u8)rtw_chip_version;
@@ -330,7 +329,7 @@ static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev)
registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable;

registry_par->hiq_filter = (u8)rtw_hiq_filter;
- return status;
+ return _SUCCESS;
}

static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
@@ -603,7 +602,6 @@ void rtw_stop_drv_threads (struct adapter *padapter)

static u8 rtw_init_default_value(struct adapter *padapter)
{
- u8 ret = _SUCCESS;
struct registry_priv *pregistrypriv = &padapter->registrypriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -665,7 +663,7 @@ static u8 rtw_init_default_value(struct adapter *padapter)
padapter->driver_ampdu_spacing = 0xFF;
padapter->driver_rx_ampdu_factor = 0xFF;

- return ret;
+ return _SUCCESS;
}

struct dvobj_priv *devobj_init(void)
@@ -709,7 +707,6 @@ void devobj_deinit(struct dvobj_priv *pdvobj)

u8 rtw_reset_drv_sw(struct adapter *padapter)
{
- u8 ret8 = _SUCCESS;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);

@@ -739,7 +736,7 @@ u8 rtw_reset_drv_sw(struct adapter *padapter)

rtw_set_signal_stat_timer(&padapter->recvpriv);

- return ret8;
+ return _SUCCESS;
}


@@ -1296,7 +1293,6 @@ int rtw_suspend_wow(struct adapter *padapter)
struct net_device *pnetdev = padapter->pnetdev;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct wowlan_ioctl_param poidparam;
- int ret = _SUCCESS;

DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter));

@@ -1364,7 +1360,7 @@ int rtw_suspend_wow(struct adapter *padapter)
DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode);
}
DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter));
- return ret;
+ return _SUCCESS;
}
#endif /* ifdef CONFIG_WOWLAN */

@@ -1375,7 +1371,6 @@ int rtw_suspend_ap_wow(struct adapter *padapter)
struct net_device *pnetdev = padapter->pnetdev;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct wowlan_ioctl_param poidparam;
- int ret = _SUCCESS;

DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter));

@@ -1417,7 +1412,7 @@ int rtw_suspend_ap_wow(struct adapter *padapter)
rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, 0, "AP-WOWLAN");

DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter));
- return ret;
+ return _SUCCESS;
}
#endif /* ifdef CONFIG_AP_WOWLAN */

@@ -1425,7 +1420,6 @@ int rtw_suspend_ap_wow(struct adapter *padapter)
static int rtw_suspend_normal(struct adapter *padapter)
{
struct net_device *pnetdev = padapter->pnetdev;
- int ret = _SUCCESS;

DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter));
if (pnetdev) {
@@ -1447,7 +1441,7 @@ static int rtw_suspend_normal(struct adapter *padapter)
padapter->intf_deinit(adapter_to_dvobj(padapter));

DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter));
- return ret;
+ return _SUCCESS;
}

int rtw_suspend_common(struct adapter *padapter)
--
2.7.4



2019-05-20 13:09:26

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: rtl8723bs: os_dep: os_intfs: fix warning Unneeded variable: "status". Return "_SUCCESS"

On Sun, May 19, 2019 at 10:27:58PM +0530, Hariprasad Kelam wrote:
> This patch fixes below warnings reported by coccicheck
>
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:228:6-12: Unneeded variable:
> "status". Return "_SUCCESS" on line 333
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:607:4-7: Unneeded variable:
> "ret". Return "_SUCCESS" on line 669
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:713:4-8: Unneeded variable:
> "ret8". Return "_SUCCESS" on line 743
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:1379:5-8: Unneeded variable:
> "ret". Return "_SUCCESS" on line 1421
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:1429:5-8: Unneeded variable:
> "ret". Return "_SUCCESS" on line 1451
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:1300:5-8: Unneeded variable:
> "ret". Return "_SUCCESS" on line 1368
>
> Signed-off-by: Hariprasad Kelam <[email protected]>
> ---
> drivers/staging/rtl8723bs/os_dep/os_intfs.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 8a9d838..71dfac5 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -225,7 +225,6 @@ static int netdev_close (struct net_device *pnetdev);
>
> static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev)
> {
> - uint status = _SUCCESS;
> struct registry_priv *registry_par = &padapter->registrypriv;
>
> registry_par->chip_version = (u8)rtw_chip_version;
> @@ -330,7 +329,7 @@ static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev)
> registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable;
>
> registry_par->hiq_filter = (u8)rtw_hiq_filter;
> - return status;
> + return _SUCCESS;
> }

If this, or any of these other functions, can only return "success",
then why return anything at all? These should be fixed up to either
properly return an error if one can happen, or be a void function and
fix up the caller function as well.

thanks,

greg k-h