Messages in this thread | | | Date | Mon, 18 Jun 2018 09:52:45 +0100 | From | Charles Keepax <> | Subject | Re: [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
| |