[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c61d8a3f-6f19-48aa-ae69-e4f3670d4b16@foss.st.com>
Date: Fri, 25 Feb 2022 14:19:50 +0100
From: Philippe CORNU <philippe.cornu@...s.st.com>
To: Nathan Chancellor <nathan@...nel.org>,
Yannick Fertre <yannick.fertre@...s.st.com>
CC: Nick Desaulniers <ndesaulniers@...gle.com>,
<dri-devel@...ts.freedesktop.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <llvm@...ts.linux.dev>,
Raphael Gallais-Pou <raphael.gallais-pou@...s.st.com>
Subject: Re: [PATCH v2] drm/stm: Avoid using val uninitialized in
ltdc_set_ycbcr_config()
On 2/22/22 16:20, Nathan Chancellor wrote:
> 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 <yannick.fertre@...s.st.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@...s.st.com>
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
>
> v1 -> v2: https://lore.kernel.org/r/20220207165304.1046867-1-nathan@kernel.org/
>
> * Use DRM_ERROR() instead of drm_err() (Philippe).
Hi Nathan,
Applied on drm-misc-next.
Many thanks for your patch,
Philippe :-)
>
> * Collect tags from v1, as nothing substantial has changed.
>
> drivers/gpu/drm/stm/ltdc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 5eeb32c9c9ce..c9bc4ccb6d43 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 */
>
> base-commit: 542898c5aa5c6a3179dffb1d1606884a63f75fed
Powered by blists - more mailing lists