Re: [PATCH] media: ov9650: avoid maybe-uninitialized warnings

From: Arnd Bergmann
Date: Thu Sep 27 2018 - 05:06:26 EST


On Wed, Sep 26, 2018 at 11:17 PM Sakari Ailus
<sakari.ailus@xxxxxxxxxxxxxxx> wrote:
>
> Hi Arnd,
>
> On Wed, Sep 26, 2018 at 02:51:01PM +0200, Arnd Bergmann wrote:
> > The regmap change causes multiple warnings like
> >
> > drivers/media/i2c/ov9650.c: In function 'ov965x_g_volatile_ctrl':
> > drivers/media/i2c/ov9650.c:889:29: error: 'reg2' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > exposure = ((reg2 & 0x3f) << 10) | (reg1 << 2) |
> > ~~~~~~~~~~~~~~~^~~~~~
> >
> > It is apparently hard for the compiler to see here if ov965x_read()
> > returned successfully or not. Besides, we have a v4l2_dbg() statement
> > that prints an uninitialized value if regmap_read() fails.
> >
> > Adding an 'else' clause avoids the ambiguity.
>
> Thanks!
>
> I'm not sure what happened here but the two lines use spaces for
> indentation. I've replaced those with tabs.

Thanks a lot, that was clearly what I had intended to send.

Arnd