From: Lee Jones <lee.jones@linaro.org>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: andy.shevchenko@gmail.com, patches@opensource.cirrus.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mfd: arizona: Don't use regmap_read_poll_timeout
Date: Tue, 3 Jul 2018 10:41:32 +0100 [thread overview]
Message-ID: <20180703094132.GQ20176@dell> (raw)
In-Reply-To: <20180618085245.GE18740@imbe.wolfsonmicro.main>
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
prev parent reply other threads:[~2018-07-03 9:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 11:57 [PATCH v2] mfd: arizona: Don't use regmap_read_poll_timeout Charles Keepax
2018-06-18 6:27 ` Lee Jones
2018-06-18 8:52 ` Charles Keepax
2018-07-03 9:41 ` Lee Jones [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180703094132.GQ20176@dell \
--to=lee.jones@linaro.org \
--cc=andy.shevchenko@gmail.com \
--cc=ckeepax@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox