lkml.org 
[lkml]   [2018]   [Jun]   [18]   [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, 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?

Thanks,
Charles

\
 
 \ /
  Last update: 2018-06-18 10:53    [W:0.083 / U:2.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site