From: Nathan Chancellor Date: Tue, 22 Feb 2022 15:20:46 +0000 (-0700) Subject: drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config() X-Git-Tag: v6.1-rc5~617^2^2~516 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b2f68f196a5b23c61777078f5c7d0d19626b5e4;p=platform%2Fkernel%2Flinux-starfive.git 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: 484e72d3146b ("drm/stm: ltdc: add support of ycbcr pixel formats") Link: https://github.com/ClangBuiltLinux/linux/issues/1575 Acked-by: Yannick Fertre Reviewed-by: Nick Desaulniers Reviewed-by: Raphael Gallais-Pou Signed-off-by: Nathan Chancellor Signed-off-by: Philippe Cornu Link: https://patchwork.freedesktop.org/patch/msgid/20220222152045.484610-1-nathan@kernel.org --- diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 5eeb32c..c9bc4cc 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -624,7 +624,8 @@ static inline void ltdc_set_ycbcr_config(struct drm_plane *plane, u32 drm_pix_fm break; default: /* RGB or not a YCbCr supported format */ - break; + DRM_ERROR("Unsupported pixel format: %u\n", drm_pix_fmt); + return; } /* Enable limited range */