Re: [PATCH] staging: r8188eu: remove unneeded variable

From: Pavel Skripkin
Date: Tue Nov 02 2021 - 04:24:04 EST


On 11/2/21 10:32, cgel.zte@xxxxxxxxx wrote:
From: Changcheng Deng <deng.changcheng@xxxxxxxxxx>

Remove unneeded variable used to store return value.

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Changcheng Deng <deng.changcheng@xxxxxxxxxx>
---
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 995a0248c26f..98863a06bdb6 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -350,7 +350,6 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_c
int 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;
@@ -373,7 +372,7 @@ int init_mlme_ext_priv(struct adapter *padapter)
pmlmeext->active_keep_alive_check = true;
- return res;
+ return _SUCCESS;
}

Looks like it always return success, so, maybe, it should return just void?

void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
@@ -1611,7 +1610,6 @@ unsigned int OnAtim(struct adapter *padapter, struct recv_frame *precv_frame)
unsigned int on_action_spct(struct adapter *padapter, struct recv_frame *precv_frame)
{
- unsigned int ret = _FAIL;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 *pframe = precv_frame->rx_data;
@@ -1644,7 +1642,7 @@ unsigned int on_action_spct(struct adapter *padapter, struct recv_frame *precv_f
}
exit:
- return ret;
+ return _FAIL;
}
unsigned int OnAction_qos(struct adapter *padapter, struct recv_frame *precv_frame)


This looks odd from the beginning... Why return _FAIL even on success?
Anyway, nothing checks these handlers return values:

ptable = &OnAction_tbl[i];
if (category == ptable->num)
ptable->func(padapter, precv_frame);

So, it worth to make them void too, but, I guess, it's out of scope of current patch



With regards,
Pavel Skripkin