lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 30 Mar 2020 03:03:21 +0200
From:   Stefano Brivio <sbrivio@...hat.com>
To:     Simran Singhal <singhalsimran0@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
        outreachy-kernel <outreachy-kernel@...glegroups.com>
Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove multiple
 assignments

On Wed, 25 Mar 2020 19:52:26 +0530
Simran Singhal <singhalsimran0@...il.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@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ