Re: [PATCH] staging: rtl8723bs: core: rtw_ap: fix Unneeded variable: "ret". Return "0"

From: Greg Kroah-Hartman
Date: Mon May 20 2019 - 04:55:42 EST


On Sun, May 19, 2019 at 10:14:45PM +0530, Hariprasad Kelam wrote:
> This patch fixes below warnings reported by coccicheck
>
> drivers/staging/rtl8723bs/core/rtw_ap.c:1400:5-8: Unneeded variable:
> "ret". Return "0" on line 1441
> drivers/staging/rtl8723bs/core/rtw_ap.c:2195:5-8: Unneeded variable:
> "ret". Return "0" on line 2205
>
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@xxxxxxxxx>
> ---
> drivers/staging/rtl8723bs/core/rtw_ap.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
> index bc02306..a1b5ba4 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
> @@ -1397,7 +1397,6 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
> int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
> {
> struct list_head *plist, *phead;
> - int ret = 0;
> struct rtw_wlan_acl_node *paclnode;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
> @@ -1438,7 +1437,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
>
> DBG_871X("%s, acl_num =%d\n", __func__, pacl_list->num);
>
> - return ret;
> + return 0;
> }

If this function can never fail, why does it have a return value at all?
Please fix that up instead.

>
> u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
> @@ -2192,7 +2191,6 @@ u8 ap_free_sta(
> int rtw_sta_flush(struct adapter *padapter)
> {
> struct list_head *phead, *plist;
> - int ret = 0;
> struct sta_info *psta = NULL;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> @@ -2202,7 +2200,7 @@ int rtw_sta_flush(struct adapter *padapter)
> DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev));
>
> if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
> - return ret;
> + return 0;
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> phead = &pstapriv->asoc_list;
> @@ -2227,7 +2225,7 @@ int rtw_sta_flush(struct adapter *padapter)
>
> associated_clients_update(padapter, true);
>
> - return ret;
> + return 0;
> }

Same here.

thanks,

greg k-h