2022-04-05 01:50:31

by Rebecca Mckeever

[permalink] [raw]
Subject: [PATCH 0/3] staging: r8188eu: clean up two *_cmd_callback() functions in rtw_cmd.c

These patches perform cleanup in/around functions
rtw_survey_cmd_callback() and rtw_joinbss_cmd_callback().

Rebecca Mckeever (3):
staging: r8188eu: remove handlerOS independent comment
staging: r8188eu: combine both sides of conditional statement
staging: r8188eu: add blank line between functions

drivers/staging/r8188eu/core/rtw_cmd.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

--
2.32.0


2022-04-05 02:58:21

by Rebecca Mckeever

[permalink] [raw]
Subject: [PATCH 2/3] staging: r8188eu: combine both sides of conditional statement

Both sides of conditional statement are the same except for the comment.
Additional instance found with git grep.

Suggested-by: Dan Carpenter <[email protected]>
Signed-off-by: Rebecca Mckeever <[email protected]>
---
drivers/staging/r8188eu/core/rtw_cmd.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index da455eb4d8cb..2d316a6c8294 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -1411,11 +1411,9 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

- if (pcmd->res == H2C_DROPPED) {
+ if (pcmd->res != H2C_SUCCESS) {
/* TODO: cancel timer and do timeout handler directly... */
_set_timer(&pmlmepriv->scan_to_timer, 1);
- } else if (pcmd->res != H2C_SUCCESS) {
- _set_timer(&pmlmepriv->scan_to_timer, 1);
}

/* free cmd */
@@ -1445,11 +1443,9 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

- if (pcmd->res == H2C_DROPPED) {
+ if (pcmd->res != H2C_SUCCESS) {
/* TODO: cancel timer and do timeout handler directly... */
_set_timer(&pmlmepriv->assoc_timer, 1);
- } else if (pcmd->res != H2C_SUCCESS) {
- _set_timer(&pmlmepriv->assoc_timer, 1);
}

rtw_free_cmd_obj(pcmd);
--
2.32.0

2022-04-13 02:05:15

by Ira Weiny

[permalink] [raw]
Subject: Re: [PATCH 2/3] staging: r8188eu: combine both sides of conditional statement

On Sun, Apr 03, 2022 at 02:17:05PM -0500, Rebecca Mckeever wrote:
> Both sides of conditional statement are the same except for the comment.
> Additional instance found with git grep.
>
> Suggested-by: Dan Carpenter <[email protected]>
> Signed-off-by: Rebecca Mckeever <[email protected]>

Reviewed-by: Ira Weiny <[email protected]>

> ---
> drivers/staging/r8188eu/core/rtw_cmd.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
> index da455eb4d8cb..2d316a6c8294 100644
> --- a/drivers/staging/r8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/r8188eu/core/rtw_cmd.c
> @@ -1411,11 +1411,9 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
> {
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>
> - if (pcmd->res == H2C_DROPPED) {
> + if (pcmd->res != H2C_SUCCESS) {
> /* TODO: cancel timer and do timeout handler directly... */
> _set_timer(&pmlmepriv->scan_to_timer, 1);
> - } else if (pcmd->res != H2C_SUCCESS) {
> - _set_timer(&pmlmepriv->scan_to_timer, 1);
> }
>
> /* free cmd */
> @@ -1445,11 +1443,9 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
> {
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>
> - if (pcmd->res == H2C_DROPPED) {
> + if (pcmd->res != H2C_SUCCESS) {
> /* TODO: cancel timer and do timeout handler directly... */
> _set_timer(&pmlmepriv->assoc_timer, 1);
> - } else if (pcmd->res != H2C_SUCCESS) {
> - _set_timer(&pmlmepriv->assoc_timer, 1);
> }
>
> rtw_free_cmd_obj(pcmd);
> --
> 2.32.0
>