From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC7FDC433F5 for ; Tue, 22 Feb 2022 15:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qTCEiwC/VjBYVXLHZbZ3rpFDnpCamNsrVH8slV5623U=; b=tVi7lfO6ul15QH oLWeQoNY7sZN1uJ7mbPmZ5Hm2bI8VqmTteDOLPk2dke92QOy70RQYz/cVB7UyryeoDjlbAgiea2HX RaYSg32dg/V3zQzhtqfUBjol+T47Q09Qj7/yYCVpQInyyxZroXV9YXyAhm8SczFQ/72Qm5ONNhgcG mD9vp1t6WRgnlPy4RZp8DQsso8S4c1oRQIRUtMcLf8o19gxKIenLfRyA1eg/HY0SvTHIUCAa3zgbk uyDG/1R9wOoe5IsfsNRnufxY/ORREDYi1c+XgZYEBzc9jU6cgvTfO+PLknzhtPnyGa6c0x4mULiQT 5u7dK8UcxeHtREV7+Z1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMX2l-00ACq9-FM; Tue, 22 Feb 2022 15:25:35 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMX0m-00ABt9-Td for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 15:23:34 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B895615AF; Tue, 22 Feb 2022 15:23:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00490C340E8; Tue, 22 Feb 2022 15:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645543411; bh=36C5XSTwUOyfNvIcqQ9TuoXhkklJD5exPe/8nUTTeMo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=urLBibFGvdPJvEFgJ9BsfC5Bsg1TMwd4yAIQItElZeHpfxbBUwiq+uVBZ6rCsy5nZ DxRN/Jf4b9JFwNA19WCikuBAWnLuwy60r33trFBY6LkxYWmfxJ8bA41GzTQQejHvh2 fDBuky1YfbotkK4ulW8pGdbsQlt4kaC+F/21xSno517Mn2E/8owx36fe3zGd1KsiQO mDU/XdDw89zUgNRcgJNnSfNFcD3mlI1zeNB1MP2mCkVJUlkw4uToyxzF6+J1Ty58Vz PBIJOjNCNVBFgiubAridjRXeowbCoQdTPM5+iqTddQJ90VTYucnhiCMhOIYYXu750w bkLWBMZnUmJJA== Date: Tue, 22 Feb 2022 08:23:27 -0700 From: Nathan Chancellor To: Philippe CORNU Cc: Nick Desaulniers , Yannick Fertre , Benjamin Gaignard , dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config() Message-ID: References: <20220207165304.1046867-1-nathan@kernel.org> <430ee06d-04e7-3b8b-bf11-48a7b62eaf18@foss.st.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <430ee06d-04e7-3b8b-bf11-48a7b62eaf18@foss.st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220222_072333_110756_3AF253CC X-CRM114-Status: GOOD ( 28.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 22, 2022 at 11:54:04AM +0100, Philippe CORNU wrote: > > > On 2/7/22 8:44 PM, Nick Desaulniers wrote: > > On Mon, Feb 7, 2022 at 8:53 AM 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 > > > Signed-off-by: Nathan Chancellor > > > --- > > > 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..447ddde1786c 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_err(plane->dev, "Unsupported pixel format: %u\n", drm_pix_fmt); > > > > This is fine, but in the future you should add an explicit > > #include > > to avoid implicit header dependencies (like the ones that Mingo is > > trying to detangle) for the declaration of drm_err. `drm_vprintf` > > needs it, too. > > > > Reviewed-by: Nick Desaulniers > > > > Hi Nick, > and thank you for having pointing this. > > Hi Nathan, > May I ask you please to update your patch changing drm_err(plane->dev, ) > with DRM_ERROR(). Sure thing, v2 has been sent: https://lore.kernel.org/r/20220222152045.484610-1-nathan@kernel.org/ I used drm_err() as I saw DRM_ERROR() was deprecated but I get internal driver consistency is important. Cheers, Nathan > Big thank you, > > Philippe :-) > > > > > > + return; > > > } > > > > > > /* Enable limited range */ > > > > > > base-commit: 542898c5aa5c6a3179dffb1d1606884a63f75fed > > > -- > > > 2.35.1 > > > > > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel