All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Kemnade <andreas@kemnade.info>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Tom Rix <trix@redhat.com>,
	nathan@kernel.org, ndesaulniers@google.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, "H. Nikolaus Schaller" <hns@goldelico.com>
Subject: Re: [PATCH] power: supply: twl4030-charger: remove unused cur_reg variable
Date: Sat, 1 Apr 2023 23:39:16 +0200	[thread overview]
Message-ID: <20230401233916.374ffe1a@aktux> (raw)
In-Reply-To: <20230401203026.nzk4aygv7sr7quhe@mercury.elektranox.org>

On Sat, 1 Apr 2023 22:30:26 +0200
Sebastian Reichel <sebastian.reichel@collabora.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@redhat.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

      reply	other threads:[~2023-04-01 21:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01 11:34 [PATCH] power: supply: twl4030-charger: remove unused cur_reg variable Tom Rix
2023-04-01 20:30 ` Sebastian Reichel
2023-04-01 21:39   ` Andreas Kemnade [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230401233916.374ffe1a@aktux \
    --to=andreas@kemnade.info \
    --cc=hns@goldelico.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.