* [PATCH] staging: rtl8723bs: Remove multiple assignments
@ 2020-03-25 14:22 Simran Singhal
2020-03-30 1:03 ` [Outreachy kernel] " Stefano Brivio
0 siblings, 1 reply; 2+ messages in thread
From: Simran Singhal @ 2020-03-25 14:22 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, linux-kernel, outreachy-kernel
Remove multiple assignments by factorizing them.
Problem found using checkpatch.pl:-
CHECK: multiple assignments should be avoided
Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_cmd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 61a9bf61b976..744b40dd4cf0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -194,7 +194,9 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
- pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0;
+ pcmdpriv->cmd_issued_cnt = 0;
+ pcmdpriv->cmd_done_cnt = 0;
+ pcmdpriv->rsp_cnt = 0;
mutex_init(&pcmdpriv->sctx_mutex);
exit:
@@ -2138,7 +2140,8 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *
goto exit;
}
- psta->aid = psta->mac_id = passocsta_rsp->cam_id;
+ psta->aid = passocsta_rsp->cam_id;
+ psta->mac_id = passocsta_rsp->cam_id;
spin_lock_bh(&pmlmepriv->lock);
--
2.17.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove multiple assignments
2020-03-25 14:22 [PATCH] staging: rtl8723bs: Remove multiple assignments Simran Singhal
@ 2020-03-30 1:03 ` Stefano Brivio
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Brivio @ 2020-03-30 1:03 UTC (permalink / raw)
To: Simran Singhal; +Cc: devel, Greg Kroah-Hartman, linux-kernel, outreachy-kernel
On Wed, 25 Mar 2020 19:52:26 +0530
Simran Singhal <singhalsimran0@gmail.com> wrote:
> Remove multiple assignments by factorizing them.
> Problem found using checkpatch.pl:-
> CHECK: multiple assignments should be avoided
>
> Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
> ---
> drivers/staging/rtl8723bs/core/rtw_cmd.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> index 61a9bf61b976..744b40dd4cf0 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -194,7 +194,9 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
>
> pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
>
> - pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0;
> + pcmdpriv->cmd_issued_cnt = 0;
> + pcmdpriv->cmd_done_cnt = 0;
> + pcmdpriv->rsp_cnt = 0;
I think this is better than the original because the original exceeds
80 columns (and looks horrible in general). But the second hunk:
>
> mutex_init(&pcmdpriv->sctx_mutex);
> exit:
> @@ -2138,7 +2140,8 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *
> goto exit;
> }
>
> - psta->aid = psta->mac_id = passocsta_rsp->cam_id;
> + psta->aid = passocsta_rsp->cam_id;
> + psta->mac_id = passocsta_rsp->cam_id;
I would leave this alone, because psta->aid is really the same thing
here, it's not just a value that happens to be assigned to both by
accident.
--
Stefano
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-30 1:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 14:22 [PATCH] staging: rtl8723bs: Remove multiple assignments Simran Singhal
2020-03-30 1:03 ` [Outreachy kernel] " Stefano Brivio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).