From patchwork Mon Feb 7 16:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12737677 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 96B5AC433EF for ; Mon, 7 Feb 2022 16:54:43 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=uTkUlTlnxT/3c+lPMt2COB3efYNu8vVpUavHV46THI8=; b=qYHiQ54aDHd6d4 09HVANZAzUvCJgOChpr1qEgJsPE1AeqMqHX//nb5qKrm2dRz84nvSZX/W6uUxO5ymL0Q+pEQjf4eb no3u0n1LtEPljPCmF0Ht5FLyp7M+Ayi2FnocMgok8XNKo5mE4VvCMU2WBdJBTgzGYYVhSsEz27NA6 y1sD+sknesLB2I6skIyxHQ4sh1vCFRQ0TQrZ1xxvKHugTMiBbGO2h7NgkjdsR929vxGuDaJxznRNU oX0IRTsGF3Qhj0KDJUVrKf4g1sxkUgnTBRbZwkHc2yM7wttGhxQScRnGKAOXw572s+s1sU7lgT4cK 0oW/IoDheHglXELupmWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH7GW-00BDtf-9V; Mon, 07 Feb 2022 16:53:24 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH7GS-00BDs2-3p for linux-arm-kernel@lists.infradead.org; Mon, 07 Feb 2022 16:53:21 +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 ams.source.kernel.org (Postfix) with ESMTPS id 54772B812AA; Mon, 7 Feb 2022 16:53:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D23FC340ED; Mon, 7 Feb 2022 16:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644252797; bh=X39xYx51fikLum/6dHtmOj01yGauqmQNBgR0dA+t/T4=; h=From:To:Cc:Subject:Date:From; b=daQ/U5GjWfNjCv/LB9Bb4/XbLHnn7bL1gcbSSNpasT2b/VlhN0hVFOpSqKam/0dEa bpyiUxlfQlTzbqNwEtgG7vDWrd8uTKgWFaeN1z9j77gL17m0Fwx1GvlcoFD63IOhZ6 aUAt6UccpTa0iMVMP9JhHEpJoTaCOugnlvW8u+Xcb44//9MHg7zH6jZkEevSiBr5bN xJhMylojME3ZonO9bIqbR2RjxTze8Mkm7FQcxq352Y2N5gUjNNJ/fGADzZoIUk2KIm pNe/efhQ4UaqmLRW6nyXUhxuqSKaDTbO0GKhwVkYXJ8XUDIdziHpTCA1yN/rYFThfc pTYRUq7PJmu3g== From: Nathan Chancellor To: Yannick Fertre , Philippe Cornu , Benjamin Gaignard Cc: Nick Desaulniers , 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, Nathan Chancellor Subject: [PATCH] drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config() Date: Mon, 7 Feb 2022 09:53:04 -0700 Message-Id: <20220207165304.1046867-1-nathan@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220207_085320_331253_E12B76E1 X-CRM114-Status: GOOD ( 11.57 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Nick Desaulniers Reviewed-by: Raphael Gallais-Pou Acked-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) base-commit: 542898c5aa5c6a3179dffb1d1606884a63f75fed 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); + return; } /* Enable limited range */