lkml.org 
[lkml]   [2012]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] regmap: silence GCC warning
On Wed, Oct 03, 2012 at 09:23:36AM +0200, Paul Bolle wrote:
> On Tue, 2012-10-02 at 20:11 -0400, Valdis.Kletnieks@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 example, zero. That would be useless input,
> > > > however.)

> > But gcc doesn't know what "useless input" means, semantically.

> Correct. When this function is compiled gcc has to take into account
> that 'val_len' will be called with useless input, like zero.

> By the way, GCC doesn't warn if I add an early check whether 'val_count'
> is non-zero:

That's a much more useful fix, bodging things by just forcing things to
be assigned (especially with the way you were converting the immediate
returns) is generally terrible - it's just shutting up the errors
without actually fixing any issues that really exist and means that if
the compiler ever notices actual issues we won't see them.


\
 
 \ /
  Last update: 2012-10-03 13:21    [W:0.080 / U:1.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site