staging: atomisp: avoid false-positive maybe-uninitialized warning
authorArnd Bergmann <arnd@arndb.de>
Wed, 29 Mar 2017 21:12:21 +0000 (23:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Apr 2017 08:11:50 +0000 (10:11 +0200)
commit8d7cd91da45b11046c587fbaec9f42116e1cca93
tree8b30684f3e6c95f90710491b2b734720d6eb88fd
parent7afe8f84f7938b1ba9ea3c5296ebcc8a7fb210eb
staging: atomisp: avoid false-positive maybe-uninitialized warning

In combination with CONFIG_PROFILE_ANNOTATED_BRANCHES=y, the unlikely()
inside of the WARN() macro becomes too complex for gcc to see that
we don't use the output arguments of mt9m114_to_res() are used
correctly:

drivers/staging/media/atomisp/i2c/mt9m114.c: In function 'mt9m114_get_fmt':
drivers/staging/media/atomisp/i2c/mt9m114.c:817:13: error: 'height' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  int width, height;
             ^~~~~~
drivers/staging/media/atomisp/i2c/mt9m114.c: In function 'mt9m114_s_exposure_selection':
drivers/staging/media/atomisp/i2c/mt9m114.c:1179:13: error: 'height' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Without WARN_ON(), there is no problem, so by simply replacing it with
v4l2_err(), the warnings go away. The WARN() output is also not needed
here, as we'd probably catch the problem before even getting here,
and other checks for the same condition already use v4l2_err.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/atomisp/i2c/mt9m114.c