[alsa-devel] Missing return check of of_property_read_*()

Takashi Iwai tiwai at suse.de
Wed Sep 9 17:07:45 CEST 2015


On Wed, 09 Sep 2015 17:05:05 +0200,
Lars-Peter Clausen wrote:
> 
> On 09/09/2015 05:01 PM, Takashi Iwai wrote:
> > On Wed, 09 Sep 2015 16:51:58 +0200,
> > Mark Brown wrote:
> >>
> >> On Wed, Sep 09, 2015 at 04:40:36PM +0200, Takashi Iwai wrote:
> >>
> >>> I hoped that I wouldn't need to write this kind of post, but since
> >>> nothing happened so far, so here we go:
> >>
> >> Could you be more specific about nothing happening here...
> > 
> > A wonderful gift such like a devoted maintainer/developer already
> > fixing these bugs magically :)
> > 
> >>> The following compile warnings are present for quite some time.  They
> >>> are due to the lack of return check from of_property_read*().
> >>
> >>> sound/soc/codecs/cs35l32.c: In function ‘cs35l32_i2c_probe’:
> >>> sound/soc/codecs/cs35l32.c:278:2: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> >>>   switch (val) {
> >>>   ^
> >>> sound/soc/codecs/cs35l32.c:272:15: note: ‘val’ was declared here
> >>>   unsigned int val;
> >>>                ^
> >>
> >> How are you generating these - what compiler and config?  None of the
> >> build bots are reporting any of the warnings you have here.
> > 
> > Then maybe this can be seen since gcc 5.x.  A good progress of gcc.
> > I've seen this since the beginning of merge for cs35l32.c (and I
> > reported this already at merging the branch).
> > 
> > There is nothing special in config or compiler option, just use the
> > normal x86-64 build with CONFIG_COMPILE_TEST.  I'm using gcc-5.1.1 for
> > now.
> 
> I think you'll get them for any config with CONFIG_OF disabled. I've been
> seeing those warnings for a while now when compile-testing for x86 and I'm
> still on gcc 4.9.

Ah, good point.  That can trigger the check easily, of course.
But then I don't know why 0day check didn't catch these.

> But even if you don't get the warning the code is still broken, the compiler
> just does not know.

Right.


Takashi


More information about the Alsa-devel mailing list