[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180618085245.GE18740@imbe.wolfsonmicro.main>
Date: Mon, 18 Jun 2018 09:52:45 +0100
From: Charles Keepax <ckeepax@...nsource.cirrus.com>
To: Lee Jones <lee.jones@...aro.org>
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, 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
Powered by blists - more mailing lists