lkml.org 
[lkml]   [2018]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2018-07-03 11:42    [W:0.065 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site