]> git.baikalelectronics.ru Git - kernel.git/commit
drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config()
authorNathan Chancellor <nathan@kernel.org>
Tue, 22 Feb 2022 15:20:46 +0000 (08:20 -0700)
committerPhilippe Cornu <philippe.cornu@foss.st.com>
Fri, 25 Feb 2022 13:14:07 +0000 (14:14 +0100)
commitf6d5a5fe61514ac3525db9fd1bf7c97ab26372ba
tree6209edc9d594deeaccbc951f8d8094d98e454b29
parent964be1a644867d9e0f987a633733b8d1cd28dbfa
drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config()

Clang warns:

  drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
          default:
          ^~~~~~~
  drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here
          val |= LxPCR_YCEN;
          ^~~
  drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning
          u32 val;
                 ^
                  = 0
  1 warning generated.

Use a return instead of break in the default case to fix the warning.
Add an error message so that this return is not silent, which could hide
issues in the future.

Fixes: 8b9b60529ef9 ("drm/stm: ltdc: add support of ycbcr pixel formats")
Link: https://github.com/ClangBuiltLinux/linux/issues/1575
Acked-by: Yannick Fertre <yannick.fertre@foss.st.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220222152045.484610-1-nathan@kernel.org
drivers/gpu/drm/stm/ltdc.c