AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Hung <alex.hung@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
	Leo Li <sunpeng.li@amd.com>,
	Aurabindo Pillai <aurabindo.pillai@amd.com>,
	Roman Li <roman.li@amd.com>, Wayne Lin <wayne.lin@amd.com>,
	Tom Chung <chiahsuan.chung@amd.com>,
	"Fangzhi Zuo" <jerry.zuo@amd.com>,
	Dan Wheeler <daniel.wheeler@amd.com>, Ray Wu <Ray.Wu@amd.com>,
	Ivan Lipski <ivan.lipski@amd.com>, Alex Hung <alex.hung@amd.com>
Subject: [PATCH 5/8] drm/amd/display: Remove redundant initializers
Date: Wed, 25 Feb 2026 16:57:44 -0700	[thread overview]
Message-ID: <20260226000048.68030-6-alex.hung@amd.com> (raw)
In-Reply-To: <20260226000048.68030-1-alex.hung@amd.com>

[WHAT]
Remove unnecessary default value assignments for variables that
are unconditionally assigned before use.

Linux kernel code style prefers no assignments during initialization
when variables are assigned unconditionally as they can obscures
the actual data flow. In addition, compilers will be able to catch them
if variables are used without being updated later in all conditions.

This is reported as UNUSED_VALUE errors by Coverity.

Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
---
 .../gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c   | 10 +++++-----
 .../drm/amd/display/dc/resource/dcn42/dcn42_resource.c |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c
index 19df8b47248b..d3cc624cd758 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c
@@ -105,7 +105,7 @@ union dcn42_dpia_host_router_bw {
 static uint32_t dcn42_smu_wait_for_response(struct clk_mgr_internal *clk_mgr,
 		unsigned int delay_us, unsigned int max_retries)
 {
-	uint32_t res_val = DALSMC_Result_CmdRejectedBusy;
+	uint32_t res_val;
 
 	do {
 		res_val = REG_READ(DAL_RESP_REG);
@@ -180,7 +180,7 @@ int dcn42_smu_get_pmfw_version(struct clk_mgr_internal *clk_mgr)
 
 int dcn42_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dispclk_khz)
 {
-	int actual_dispclk_set_mhz = -1;
+	int actual_dispclk_set_mhz;
 
 	if (!clk_mgr->smu_present)
 		return requested_dispclk_khz;
@@ -199,7 +199,7 @@ int dcn42_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dispcl
 
 int dcn42_smu_set_hard_min_dcfclk(struct clk_mgr_internal *clk_mgr, int requested_dcfclk_khz)
 {
-	int actual_dcfclk_set_mhz = -1;
+	int actual_dcfclk_set_mhz;
 
 	if (!clk_mgr->smu_present)
 		return requested_dcfclk_khz;
@@ -217,7 +217,7 @@ int dcn42_smu_set_hard_min_dcfclk(struct clk_mgr_internal *clk_mgr, int requeste
 
 int dcn42_smu_set_min_deep_sleep_dcfclk(struct clk_mgr_internal *clk_mgr, int requested_min_ds_dcfclk_khz)
 {
-	int actual_min_ds_dcfclk_mhz = -1;
+	int actual_min_ds_dcfclk_mhz;
 
 	if (!clk_mgr->smu_present)
 		return requested_min_ds_dcfclk_khz;
@@ -235,7 +235,7 @@ int dcn42_smu_set_min_deep_sleep_dcfclk(struct clk_mgr_internal *clk_mgr, int re
 
 int dcn42_smu_set_dppclk(struct clk_mgr_internal *clk_mgr, int requested_dpp_khz)
 {
-	int actual_dppclk_set_mhz = -1;
+	int actual_dppclk_set_mhz;
 
 	if (!clk_mgr->smu_present)
 		return requested_dpp_khz;
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
index 9f2f4d61d323..8e41367cf238 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
@@ -1811,8 +1811,8 @@ static bool dcn42_resource_construct(
 	int i, j;
 	struct dc_context *ctx = dc->ctx;
 	struct irq_service_init_data init_data;
-	uint32_t pipe_fuses = 0;
-	uint32_t num_pipes = 4;
+	uint32_t pipe_fuses;
+	uint32_t num_pipes;
 
 #undef REG_STRUCT
 #define REG_STRUCT bios_regs
-- 
2.43.0


  parent reply	other threads:[~2026-02-26  0:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 23:57 [PATCH 0/8] DC Patches Feb 25, 2026 Alex Hung
2026-02-25 23:57 ` [PATCH 1/8] drm/amd/display: Skip cursor cache reset if hubp powergating is disabled Alex Hung
2026-02-25 23:57 ` [PATCH 2/8] drm/amd/display: Fallback to boot snapshot for dispclk Alex Hung
2026-02-25 23:57 ` [PATCH 3/8] drm/amd/display: Initialize replay_state to PR_STATE_INVALID Alex Hung
2026-02-25 23:57 ` [PATCH 4/8] drm/amd/display: Silence unused variable warning Alex Hung
2026-02-25 23:57 ` Alex Hung [this message]
2026-02-25 23:57 ` [PATCH 6/8] drm/amd/display: Remove always-false branches Alex Hung
2026-02-25 23:57 ` [PATCH 7/8] drm/amd/display: Prevent integer overflow when mhz to khz Alex Hung
2026-02-25 23:57 ` [PATCH 8/8] drm/amd/display: Promote DC to 3.2.372 Alex Hung
2026-03-02 14:31 ` [PATCH 0/8] DC Patches Feb 25, 2026 Wheeler, Daniel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260226000048.68030-6-alex.hung@amd.com \
    --to=alex.hung@amd.com \
    --cc=Ray.Wu@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=ivan.lipski@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=roman.li@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=wayne.lin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox