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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ab69fd-2f65-749a-9c28-1c4e3ba9ab@inria.fr>
Date: Sat, 5 Apr 2025 04:39:21 -0400 (EDT)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Greg KH <gregkh@...uxfoundation.org>
cc: Erick Karanja <karanja99erick@...il.com>, outreachy@...ts.linux.dev, 
    philipp.g.hortmann@...il.com, linux-staging@...ts.linux.dev, 
    linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] staging: rtl8723bs: Optimize variable initialization
 in rtl8723b_hal_init.c



On Sat, 5 Apr 2025, Greg KH wrote:

> On Sat, Apr 05, 2025 at 06:14:48AM +0300, Erick Karanja wrote:
> > Optimize variable initialization by integrating the initialization
> > directly into the variable declaration in cases where the initialization
> > is simple and doesn't depend on other variables or complex expressions.
> > This makes the code more concise and readable.
> >
> > Signed-off-by: Erick Karanja <karanja99erick@...il.com>
> > ---
> >  .../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 155 +++++-------------
> >  1 file changed, 41 insertions(+), 114 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> > index e15ec6452fd0..1e980b291e90 100644
> > --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> > +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> > @@ -152,13 +152,12 @@ static int _WriteFW(struct adapter *padapter, void *buffer, u32 size)
> >  void _8051Reset8723(struct adapter *padapter)
> >  {
> >  	u8 cpu_rst;
> > -	u8 io_rst;
> > +	u8 io_rst = rtw_read8(padapter, REG_RSV_CTRL + 1);
> >
> >
> >  	/*  Reset 8051(WLMCU) IO wrapper */
> >  	/*  0x1c[8] = 0 */
> >  	/*  Suggested by Isaac@SD1 and Gimmy@SD1, coding by Lucas@...30624 */
> > -	io_rst = rtw_read8(padapter, REG_RSV_CTRL+1);
>
> Ick, no, now the comment doesn't make much sense, right?
>
> The changes you are making here are odd, why are you wanting to do this
> type of thing?  What tool suggested that these are a good idea?

I made a Coccinelle script that does this, but it's not clever enough to
detect the comments.  Like for checkpatch, the results of Coccinelle have
to be reviewed.  Many can be inappropriate.

The goal is more like to address:

int ret;

ret = 0;

julia

>
> thanks,
>
> greg k-h
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ