2019-05-22 17:56:36

by Hariprasad Kelam

[permalink] [raw]
Subject: [PATCH v2] staging: rtl8723bs: core: rtw_mlme_ext: fix warning Unneeded variable: "ret"

This patch fixes below warnings reported by coccicheck

drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1888:14-17: Unneeded
variable: "ret". Return "_FAIL" on line 1920
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:466:5-8: Unneeded
variable: "res". Return "_SUCCESS" on line 494

Signed-off-by: Hariprasad Kelam <[email protected]>
----
changes in v2:
change return type of init_mlme_ext_priv() from int to
void
We cant change return type of on_action_spct() it is a
call back function from action_handler.
So directly return _FAIL from this function.
----
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 ++-------
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +-
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 5 -----
3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index d110d45..b240a40 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -461,9 +461,8 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, RT_CHANNEL_
return chanset_size;
}

-int init_mlme_ext_priv(struct adapter *padapter)
+void init_mlme_ext_priv(struct adapter *padapter)
{
- int res = _SUCCESS;
struct registry_priv *pregistrypriv = &padapter->registrypriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
@@ -490,9 +489,6 @@ int init_mlme_ext_priv(struct adapter *padapter)
#ifdef DBG_FIXED_CHAN
pmlmeext->fixed_chan = 0xFF;
#endif
-
- return res;
-
}

void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
@@ -1885,7 +1881,6 @@ unsigned int OnAtim(struct adapter *padapter, union recv_frame *precv_frame)

unsigned int on_action_spct(struct adapter *padapter, union recv_frame *precv_frame)
{
- unsigned int ret = _FAIL;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 *pframe = precv_frame->u.hdr.rx_data;
@@ -1917,7 +1912,7 @@ unsigned int on_action_spct(struct adapter *padapter, union recv_frame *precv_fr
}

exit:
- return ret;
+ return _FAIL;
}

unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_frame)
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index f6eabad..0eb2da5 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -535,7 +535,7 @@ struct mlme_ext_priv
};

void init_mlme_default_rate_set(struct adapter *padapter);
-int init_mlme_ext_priv(struct adapter *padapter);
+void init_mlme_ext_priv(struct adapter *padapter);
int init_hw_mlme_ext(struct adapter *padapter);
void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext);
extern void init_mlme_ext_timer(struct adapter *padapter);
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 8a9d838..c2422e5 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -774,11 +774,6 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
goto exit;
}

- if (init_mlme_ext_priv(padapter) == _FAIL) {
- RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init mlme_ext_priv\n"));
- ret8 = _FAIL;
- goto exit;
- }

if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) {
DBG_871X("Can't _rtw_init_xmit_priv\n");
--
2.7.4


2019-05-23 07:21:18

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] staging: rtl8723bs: core: rtw_mlme_ext: fix warning Unneeded variable: "ret"

On Wed, May 22, 2019 at 11:25:01PM +0530, Hariprasad Kelam wrote:
> This patch fixes below warnings reported by coccicheck
>
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1888:14-17: Unneeded
> variable: "ret". Return "_FAIL" on line 1920
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:466:5-8: Unneeded
> variable: "res". Return "_SUCCESS" on line 494
>
> Signed-off-by: Hariprasad Kelam <[email protected]>
> ----
> changes in v2:
> change return type of init_mlme_ext_priv() from int to
> void
> We cant change return type of on_action_spct() it is a
> call back function from action_handler.
> So directly return _FAIL from this function.
> ----
> ---
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 ++-------
> drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +-
> drivers/staging/rtl8723bs/os_dep/os_intfs.c | 5 -----
> 3 files changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index d110d45..b240a40 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -461,9 +461,8 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, RT_CHANNEL_
> return chanset_size;
> }
>
> -int init_mlme_ext_priv(struct adapter *padapter)
> +void init_mlme_ext_priv(struct adapter *padapter)
> {
> - int res = _SUCCESS;
> struct registry_priv *pregistrypriv = &padapter->registrypriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
> @@ -490,9 +489,6 @@ int init_mlme_ext_priv(struct adapter *padapter)
> #ifdef DBG_FIXED_CHAN
> pmlmeext->fixed_chan = 0xFF;
> #endif
> -
> - return res;
> -
> }
>
> void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
> @@ -1885,7 +1881,6 @@ unsigned int OnAtim(struct adapter *padapter, union recv_frame *precv_frame)
>
> unsigned int on_action_spct(struct adapter *padapter, union recv_frame *precv_frame)
> {
> - unsigned int ret = _FAIL;
> struct sta_info *psta = NULL;
> struct sta_priv *pstapriv = &padapter->stapriv;
> u8 *pframe = precv_frame->u.hdr.rx_data;
> @@ -1917,7 +1912,7 @@ unsigned int on_action_spct(struct adapter *padapter, union recv_frame *precv_fr
> }
>
> exit:
> - return ret;
> + return _FAIL;
> }
>
> unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_frame)
> diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> index f6eabad..0eb2da5 100644
> --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> @@ -535,7 +535,7 @@ struct mlme_ext_priv
> };
>
> void init_mlme_default_rate_set(struct adapter *padapter);
> -int init_mlme_ext_priv(struct adapter *padapter);
> +void init_mlme_ext_priv(struct adapter *padapter);
> int init_hw_mlme_ext(struct adapter *padapter);
> void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext);
> extern void init_mlme_ext_timer(struct adapter *padapter);
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 8a9d838..c2422e5 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -774,11 +774,6 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
> goto exit;
> }
>
> - if (init_mlme_ext_priv(padapter) == _FAIL) {
> - RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init mlme_ext_priv\n"));
> - ret8 = _FAIL;
> - goto exit;
> - }

Why did you delete the call to this function entirely?

Is that ok? Why?

thanks,

greg k-h