• Arnd Bergmann's avatar
    staging: atomisp: avoid false-positive maybe-uninitialized warning · 8d7cd91d
    Arnd Bergmann authored
    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: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    8d7cd91d
mt9m114.c 45.9 KB