[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180703094132.GQ20176@dell>
Date: Tue, 3 Jul 2018 10:41:32 +0100
From: Lee Jones <lee.jones@...aro.org>
To: Charles Keepax <ckeepax@...nsource.cirrus.com>
Cc: andy.shevchenko@...il.com, patches@...nsource.cirrus.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mfd: arizona: Don't use regmap_read_poll_timeout
On Mon, 18 Jun 2018, Charles Keepax wrote:
> On Mon, Jun 18, 2018 at 07:27:54AM +0100, Lee Jones wrote:
> > On Mon, 04 Jun 2018, Charles Keepax wrote:
> > > @@ -240,18 +241,28 @@ static int arizona_poll_reg(struct arizona *arizona,
> > > int timeout_ms, unsigned int reg,
> > > unsigned int mask, unsigned int target)
> > > {
> > > + ktime_t timeout = ktime_add_us(ktime_get(), timeout_ms * USEC_PER_MSEC);
> > > unsigned int val = 0;
> > > - int ret;
> > > + int ret = regmap_read(arizona->regmap, reg, &val);
> >
> > I'm not a fan of this type of initialisation.
> >
> > Also, what's the point of assigning 'ret' if you never check it?
> >
>
> It could get checked if the timeout value is very small causing
> the while loop to be skipped and almost certainly will cause
> un-initialised warnings without it.
>
> I can move it to its own line if you prefer? Would you want a
> comment as well?
Yes please.
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Powered by blists - more mailing lists