drm/amd/display: Remove redundant initializers
authorAlex Hung <alex.hung@amd.com>
Wed, 18 Feb 2026 16:30:32 +0000 (09:30 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 2 Mar 2026 21:39:12 +0000 (16:39 -0500)
[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>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c

index 19df8b4..d3cc624 100644 (file)
@@ -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;
index 9f2f4d6..8e41367 100644 (file)
@@ -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