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] [day] [month] [year] [list]
Message-ID: <20230401233916.374ffe1a@aktux>
Date:   Sat, 1 Apr 2023 23:39:16 +0200
From:   Andreas Kemnade <andreas@...nade.info>
To:     Sebastian Reichel <sebastian.reichel@...labora.com>
Cc:     Tom Rix <trix@...hat.com>, nathan@...nel.org,
        ndesaulniers@...gle.com, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
        "H. Nikolaus Schaller" <hns@...delico.com>
Subject: Re: [PATCH] power: supply: twl4030-charger: remove unused cur_reg
 variable

On Sat, 1 Apr 2023 22:30:26 +0200
Sebastian Reichel <sebastian.reichel@...labora.com> wrote:

> Hi,
> 
> On Sat, Apr 01, 2023 at 07:34:32AM -0400, Tom Rix wrote:
> > clang with W=1 reports
> > drivers/power/supply/twl4030_charger.c:242:16: error: variable
> >   'cur_reg' set but not used [-Werror,-Wunused-but-set-variable]
> >         unsigned reg, cur_reg;
> >                       ^
> > This variable is not used so remove it.
> > 
> > Signed-off-by: Tom Rix <trix@...hat.com>
> > ---
> >  drivers/power/supply/twl4030_charger.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
> > index 7adfd69fe649..5fa5b2311330 100644
> > --- a/drivers/power/supply/twl4030_charger.c
> > +++ b/drivers/power/supply/twl4030_charger.c
> > @@ -239,7 +239,7 @@ static int twl4030_charger_update_current(struct twl4030_bci *bci)
> >  {
> >  	int status;
> >  	int cur;
> > -	unsigned reg, cur_reg;
> > +	unsigned reg;
> >  	u8 bcictl1, oldreg, fullreg;
> >  	bool cgain = false;
> >  	u8 boot_bci;
> > @@ -357,11 +357,9 @@ static int twl4030_charger_update_current(struct twl4030_bci *bci)
> >  	status = twl4030_bci_read(TWL4030_BCIIREF1, &oldreg);
> >  	if (status < 0)
> >  		return status;
> > -	cur_reg = oldreg;
> >  	status = twl4030_bci_read(TWL4030_BCIIREF2, &oldreg);
> >  	if (status < 0)
> >  		return status;
> > -	cur_reg |= oldreg << 8;
> >  	if (reg != oldreg) {  
> 
> I think the correct fix would be checking for (reg != cur_reg) here.
> 
yes, makes more sense.

Regards,
Andreas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ