media: i2c: fix warning in Aptina MT9V111
authorJasmin Jessich <jasmin@anw.at>
Sat, 28 Jul 2018 13:54:49 +0000 (09:54 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 7 Aug 2018 09:56:57 +0000 (05:56 -0400)
This fixes the "'idx' may be used uninitialized in this function"
warning:

drivers/media/i2c/mt9v111.c: In function 'mt9v111_set_format':
drivers/media/i2c/mt9v111.c:887:15: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  unsigned int idx;
               ^~~

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/mt9v111.c

index da8f6ab..58d5f22 100644 (file)
@@ -884,7 +884,7 @@ static int mt9v111_set_format(struct v4l2_subdev *subdev,
        struct v4l2_mbus_framefmt new_fmt;
        struct v4l2_mbus_framefmt *__fmt;
        unsigned int best_fit = ~0L;
-       unsigned int idx;
+       unsigned int idx = 0;
        unsigned int i;
 
        mutex_lock(&mt9v111->stream_mutex);