From patchwork Thu Sep 30 16:16:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12528861 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8AB7C433EF for ; Thu, 30 Sep 2021 16:16:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90B1461262 for ; Thu, 30 Sep 2021 16:16:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 90B1461262 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6A936EC01; Thu, 30 Sep 2021 16:16:54 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12B0B6EC00; Thu, 30 Sep 2021 16:16:53 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D7CF261350; Thu, 30 Sep 2021 16:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633018612; bh=nCm24fdzKI9A0hhedzu8MKlkLPZNsO0zfw6Ufjqtw1s=; h=From:To:Cc:Subject:Date:From; b=SNYZDE4cB9ZKnXPiLID0J9mW0WYRHEnkyUwDKacOGjwGmflwsAzAcbT51bZgykUPx VtCGKIPqZFfkd/8SgC455IYJwlEeIETYi11AcHBWptBBQqcyq0Kbz1fAcaV7uj0beo W3mx3RD3QKnIdlDhSbAm+7RwFWT4G0szsB1eDW0GGe+JjkTo1AAt5BC/42cJLRSNga ramwKJB8eU/cbcFoqkkUTUNU4FmIdmQmvJDkS81UpvVDV4g6RbJGZ2xczI3VjofBmO O9Qn2kidIO+6b72r4hLtBPgX9KaAMRrG+WyD203dBA+tP3+Vto8P7RG4M2l8EI4vuE nEQ9hoaflfUSQ== From: Nathan Chancellor To: Harry Wentland , Leo Li , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" Cc: Nick Desaulniers , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH] drm/amd: Initialize remove_mpcc in dcn201_update_mpcc() Date: Thu, 30 Sep 2021 09:16:42 -0700 Message-Id: <20210930161641.2333583-1-nathan@kernel.org> X-Mailer: git-send-email 2.33.0.591.gddb1055343 MIME-Version: 1.0 X-Patchwork-Bot: notify X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Clang warns: drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_hwseq.c:505:6: error: variable 'remove_mpcc' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (mpc->funcs->get_mpcc_for_dpp_from_secondary) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_hwseq.c:509:6: note: uninitialized use occurs here if (remove_mpcc != NULL && mpc->funcs->remove_mpcc_from_secondary) ^~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_hwseq.c:505:2: note: remove the 'if' if its condition is always true if (mpc->funcs->get_mpcc_for_dpp_from_secondary) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_hwseq.c:442:26: note: initialize the variable 'remove_mpcc' to silence this warning struct mpcc *remove_mpcc; ^ = NULL 1 error generated. The code already handles remove_mpcc being NULL just fine so initialize it to NULL at the beginning of the function so it is never used uninitialized. Fixes: ff7e396f822f ("drm/amd/display: add cyan_skillfish display support") Link: https://github.com/ClangBuiltLinux/linux/issues/1469 Signed-off-by: Nathan Chancellor --- drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 30fc33064c846df29888c3c61e30a064aad3a342 diff --git a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c index ceaaeeb8f2de..cfd09b3f705e 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c @@ -439,7 +439,7 @@ void dcn201_update_mpcc(struct dc *dc, struct pipe_ctx *pipe_ctx) bool per_pixel_alpha = pipe_ctx->plane_state->per_pixel_alpha && pipe_ctx->bottom_pipe; int mpcc_id, dpp_id; struct mpcc *new_mpcc; - struct mpcc *remove_mpcc; + struct mpcc *remove_mpcc = NULL; struct mpc *mpc = dc->res_pool->mpc; struct mpc_tree *mpc_tree_params = &(pipe_ctx->stream_res.opp->mpc_tree_params);