From: Valdis.Kletnieks@vt.edu
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Paul Bolle <pebolle@tiscali.nl>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regmap: silence GCC warning
Date: Tue, 02 Oct 2012 20:11:05 -0400 [thread overview]
Message-ID: <64681.1349223065@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Mon, 01 Oct 2012 11:03:21 +0100." <20121001100321.GB4360@opensource.wolfsonmicro.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 1274 bytes --]
On Mon, 01 Oct 2012 11:03:21 +0100, Mark Brown said:
> On Sun, Sep 30, 2012 at 12:15:55PM +0200, Paul Bolle wrote:
> > Building regmap.o triggers this GCC warning:
> > drivers/base/regmap/regmap.c: In function ‘regmap_raw_read’:
> > drivers/base/regmap/regmap.c:1172:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> >
> > It seems 'ret' should always be set when this function returns. See, the
> > else-branch can leave 'ret' uninitialized only if 'val_count' is zero.
> > But if 'val_count' is zero regmap_volatile_range() will return true.
I've not dug into it that deeply - is there a way that gcc is able to intuit
this fact and use it for flow analysis? If not, it's not going to be able to
include that information in its analysis.
> > That implies that 'ret' will be set in the if-branch. ('val_count' could
> > be zero if 'val_len' is, for example, zero. That would be useless input,
> > however.)
But gcc doesn't know what "useless input" means, semantically.
> > Anyhow, initializing 'ret' to -EINVAL silences GCC and is harmless.
>
> Have you reported this bug in GCC? Their flow analyis just seems to
> keep on getting worse and worse.
I'm not convinced that it's at fault in this particular case...
[-- Attachment #2: Type: application/pgp-signature, Size: 865 bytes --]
next prev parent reply other threads:[~2012-10-03 1:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-30 10:15 [PATCH] regmap: silence GCC warning Paul Bolle
2012-10-01 10:03 ` Mark Brown
2012-10-01 10:16 ` Paul Bolle
2012-10-01 10:19 ` Mark Brown
2012-10-01 10:32 ` Paul Bolle
2012-10-01 11:39 ` Mark Brown
2012-10-01 19:08 ` Paul Bolle
2012-10-01 19:11 ` Mark Brown
2012-10-03 0:11 ` Valdis.Kletnieks [this message]
2012-10-03 7:23 ` Paul Bolle
2012-10-03 11:06 ` Mark Brown
2012-10-05 22:20 ` Valdis.Kletnieks
2012-10-06 8:53 ` Mark Brown
2012-10-06 9:57 ` Paul Bolle
2012-10-08 1:14 ` Mark Brown
2012-10-08 20:06 ` [PATCH v2] " Paul Bolle
2012-10-12 6:26 ` Mark Brown
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=64681.1349223065@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pebolle@tiscali.nl \
/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;
as well as URLs for NNTP newsgroup(s).