Re: [PATCH] regmap: silence GCC warning

2012-10-07 Thread Mark Brown
On Sat, Oct 06, 2012 at 11:57:36AM +0200, Paul Bolle wrote: > 2) I hope to send in a second path shortly, changing 'num' to size_t. My > main doubt is whether its problematic that the loop index in > regmap_volatile_range() uses unsigned int too. If 'num' would exceed > UINT_MAX, that loop would

Re: [PATCH] regmap: silence GCC warning

2012-10-07 Thread Mark Brown
On Sat, Oct 06, 2012 at 11:57:36AM +0200, Paul Bolle wrote: 2) I hope to send in a second path shortly, changing 'num' to size_t. My main doubt is whether its problematic that the loop index in regmap_volatile_range() uses unsigned int too. If 'num' would exceed UINT_MAX, that loop would

Re: [PATCH] regmap: silence GCC warning

2012-10-06 Thread Paul Bolle
On Sat, 2012-10-06 at 09:53 +0100, Mark Brown wrote: > On Fri, Oct 05, 2012 at 06:20:44PM -0400, valdis.kletni...@vt.edu wrote: > > On Wed, 03 Oct 2012 09:23:36 +0200, Paul Bolle said: > > > That is another way to silence GCC here. > > > That's probably a preferable approach - that way, if a

Re: [PATCH] regmap: silence GCC warning

2012-10-06 Thread Mark Brown
On Fri, Oct 05, 2012 at 06:20:44PM -0400, valdis.kletni...@vt.edu wrote: > On Wed, 03 Oct 2012 09:23:36 +0200, Paul Bolle said: > > That is another way to silence GCC here. > That's probably a preferable approach - that way, if a bogus val_count gets > passed in, the caller will be informed of

Re: [PATCH] regmap: silence GCC warning

2012-10-06 Thread Mark Brown
On Fri, Oct 05, 2012 at 06:20:44PM -0400, valdis.kletni...@vt.edu wrote: On Wed, 03 Oct 2012 09:23:36 +0200, Paul Bolle said: That is another way to silence GCC here. That's probably a preferable approach - that way, if a bogus val_count gets passed in, the caller will be informed of the

Re: [PATCH] regmap: silence GCC warning

2012-10-06 Thread Paul Bolle
On Sat, 2012-10-06 at 09:53 +0100, Mark Brown wrote: On Fri, Oct 05, 2012 at 06:20:44PM -0400, valdis.kletni...@vt.edu wrote: On Wed, 03 Oct 2012 09:23:36 +0200, Paul Bolle said: That is another way to silence GCC here. That's probably a preferable approach - that way, if a bogus

Re: [PATCH] regmap: silence GCC warning

2012-10-05 Thread Valdis . Kletnieks
On Wed, 03 Oct 2012 09:23:36 +0200, Paul Bolle said: > By the way, GCC doesn't warn if I add an early check whether 'val_count' > is non-zero: > > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c > index c241ae2..d41527b 100644 > --- a/drivers/base/regmap/regmap.c > +++

Re: [PATCH] regmap: silence GCC warning

2012-10-05 Thread Valdis . Kletnieks
On Wed, 03 Oct 2012 09:23:36 +0200, Paul Bolle said: By the way, GCC doesn't warn if I add an early check whether 'val_count' is non-zero: diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index c241ae2..d41527b 100644 --- a/drivers/base/regmap/regmap.c +++

Re: [PATCH] regmap: silence GCC warning

2012-10-03 Thread Mark Brown
On Wed, Oct 03, 2012 at 09:23:36AM +0200, Paul Bolle wrote: > On Tue, 2012-10-02 at 20:11 -0400, valdis.kletni...@vt.edu wrote: > > On Mon, 01 Oct 2012 11:03:21 +0100, Mark Brown said: > > > > That implies that 'ret' will be set in the if-branch. ('val_count' could > > > > be zero if 'val_len'

Re: [PATCH] regmap: silence GCC warning

2012-10-03 Thread Paul Bolle
On Tue, 2012-10-02 at 20:11 -0400, valdis.kletni...@vt.edu wrote: > 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

Re: [PATCH] regmap: silence GCC warning

2012-10-03 Thread Paul Bolle
On Tue, 2012-10-02 at 20:11 -0400, valdis.kletni...@vt.edu wrote: 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:

Re: [PATCH] regmap: silence GCC warning

2012-10-03 Thread Mark Brown
On Wed, Oct 03, 2012 at 09:23:36AM +0200, Paul Bolle wrote: On Tue, 2012-10-02 at 20:11 -0400, valdis.kletni...@vt.edu wrote: On Mon, 01 Oct 2012 11:03:21 +0100, Mark Brown said: That implies that 'ret' will be set in the if-branch. ('val_count' could be zero if 'val_len' is, for

Re: [PATCH] regmap: silence GCC warning

2012-10-02 Thread Valdis . Kletnieks
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:

Re: [PATCH] regmap: silence GCC warning

2012-10-02 Thread Valdis . Kletnieks
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

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
On Mon, Oct 01, 2012 at 09:08:57PM +0200, Paul Bolle wrote: > from cached registers"). The first release shipping that commit was > v3.4. The log of a build of v3.4 using the oldest version of GCC (that > Fedora used to build v3.4) I could find also contains this warning [0]. > They used

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Paul Bolle
On Mon, 2012-10-01 at 12:39 +0100, Mark Brown wrote: > I assume this is a regression they've introduced in 4.7. For what it's worth, GCC 4.6 apparently shows identical behavior. The code that triggers this warning was (basically) introduced in commit b8fb5ab156055b745254609f4635fcfd6b7dabc8

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
On Mon, Oct 01, 2012 at 12:32:57PM +0200, Paul Bolle wrote: > On Mon, 2012-10-01 at 11:19 +0100, Mark Brown wrote: > > I haven't actually stared hard enough at the code to figure this out > > yet but given what you're changing I'd hope it's a flow analysis bug. > > I'm certainly not seeing a

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Paul Bolle
On Mon, 2012-10-01 at 11:19 +0100, Mark Brown wrote: > I haven't actually stared hard enough at the code to figure this out > yet but given what you're changing I'd hope it's a flow analysis bug. > I'm certainly not seeing a warning here. Well, you may be using another version of gcc, or using

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
On Mon, Oct 01, 2012 at 12:16:46PM +0200, Paul Bolle wrote: > On Mon, 2012-10-01 at 11:03 +0100, Mark Brown wrote: > > Have you reported this bug in GCC? > No I haven't. Since you ask, I guess you too think 'ret' is always set > when this function returns, don't you? Ie, my analysis isn't

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Paul Bolle
On Mon, 2012-10-01 at 11:03 +0100, Mark Brown wrote: > 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

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
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

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
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]

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Paul Bolle
On Mon, 2012-10-01 at 11:03 +0100, Mark Brown wrote: 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

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
On Mon, Oct 01, 2012 at 12:16:46PM +0200, Paul Bolle wrote: On Mon, 2012-10-01 at 11:03 +0100, Mark Brown wrote: Have you reported this bug in GCC? No I haven't. Since you ask, I guess you too think 'ret' is always set when this function returns, don't you? Ie, my analysis isn't obviously

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Paul Bolle
On Mon, 2012-10-01 at 11:19 +0100, Mark Brown wrote: I haven't actually stared hard enough at the code to figure this out yet but given what you're changing I'd hope it's a flow analysis bug. I'm certainly not seeing a warning here. Well, you may be using another version of gcc, or using

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
On Mon, Oct 01, 2012 at 12:32:57PM +0200, Paul Bolle wrote: On Mon, 2012-10-01 at 11:19 +0100, Mark Brown wrote: I haven't actually stared hard enough at the code to figure this out yet but given what you're changing I'd hope it's a flow analysis bug. I'm certainly not seeing a warning

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Paul Bolle
On Mon, 2012-10-01 at 12:39 +0100, Mark Brown wrote: I assume this is a regression they've introduced in 4.7. For what it's worth, GCC 4.6 apparently shows identical behavior. The code that triggers this warning was (basically) introduced in commit b8fb5ab156055b745254609f4635fcfd6b7dabc8

Re: [PATCH] regmap: silence GCC warning

2012-10-01 Thread Mark Brown
On Mon, Oct 01, 2012 at 09:08:57PM +0200, Paul Bolle wrote: from cached registers). The first release shipping that commit was v3.4. The log of a build of v3.4 using the oldest version of GCC (that Fedora used to build v3.4) I could find also contains this warning [0]. They used