From patchwork Tue Feb 22 15:20:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12755408 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 6EFC9C433F5 for ; Tue, 22 Feb 2022 15:26:28 +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=9odlRZcNWM2qUk4RPeB2wFSUomSNbO1eSV58jp0eosI=; b=IBnVZhP89nAwLk iSNVR7YrWNUAHQfrAE03wMYHG+nbDi1YKESjRRya2WA45Wc4ucZ7LDDwkl4NEMtkHzj/JRlXtiarA ITJTk72q2vxzBtYis8vhhOrubN29wIDJmQpjz/VLDZnYsV0dSV+sxlkkDirV/D+9H6PXbh1xzutyK B/dcGEh4OBbeDQZZxdU6WxzLU92sVshwUu69NmdPUmGCsOIfBfnaoiJEUjoAMYFJuEeFaNBR4HNpW c2s3q0nmIVuFdLsfe7BwFW8sF0R0FWNx76m7LJ7QuXunUN+TL0Ijt2suPeJLZ94Qa//4UE/e8wSAN WDM3v6VgmDzAA2kSiBrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMX28-00ACX9-Jk; Tue, 22 Feb 2022 15:24:57 +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 1nMWza-00ABDl-DQ for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 15:22: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 5A46BB819B5; Tue, 22 Feb 2022 15:22:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35FE0C340E8; Tue, 22 Feb 2022 15:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645543335; bh=dJFaztZbOTKlwjszD+cQgkDqaaoQUaeR4abG0LlrMB4=; h=From:To:Cc:Subject:Date:From; b=DXHzm1Ojr/JdzsxpKmL+iNBWnbLZMRdxOs3Z6Lw0U0yZwOti1yflN+C6vng2Eba++ i+vpqCBIIMuKux+/wtJht32wzJ7HVm3kE5VkuRBFdiSbB8S4Hlk7Lcgz5uZsekJXE1 qV1Ljp+h6xRJF7YXQN/+qDTtQRuPAyRvTXZSJwAOnOfKMwOBcEePpACcjr6Vrb7HwY 0UIwnMCgtZ54v+f+KYU6kpPC1h4J1ojPkGhkjPPWAPwBuastYyBzoktQThSsGVt4Z6 73dHlUoFqFrUoSU0oK12YMxzPSHt9lFm48gh1/2cesQFXcKyu40FPSTA0i57xvcuN4 Mf9izYSZYCRLg== From: Nathan Chancellor To: Yannick Fertre , Philippe Cornu 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 , Raphael Gallais-Pou Subject: [PATCH v2] drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config() Date: Tue, 22 Feb 2022 08:20:46 -0700 Message-Id: <20220222152045.484610-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-20220222_072218_848273_67F241B7 X-CRM114-Status: GOOD ( 11.97 ) 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 Acked-by: Yannick Fertre Reviewed-by: Nick Desaulniers Reviewed-by: Raphael Gallais-Pou Signed-off-by: Nathan Chancellor --- v1 -> v2: https://lore.kernel.org/r/20220207165304.1046867-1-nathan@kernel.org/ * Use DRM_ERROR() instead of drm_err() (Philippe). * Collect tags from v1, as nothing substantial has changed. 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..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 */