]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: smu7: Remove stale error check in smu7_hwmgr_backend_init
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Fri, 10 Apr 2026 12:38:56 +0000 (18:08 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Apr 2026 18:49:54 +0000 (14:49 -0400)
smu7_hwmgr_backend_init() is responsible for initializing the SMU7 power
management backend. It allocates and sets up the backend structure,
initializes voltage tables, configures dependency tables, and prepares
platform-specific power and clock parameters.

The function follows a typical pattern where each initialization step
returns a status in "result", and failures are handled via a common
"goto fail" path that performs cleanup.

Commit 2c21648bb814 ("drm/amd/pm/smu7: Remove non-functional SMU7
voltage dependency on DAL") removed a function call in this
initialization sequence, but left behind the corresponding error check.

As a result, "result" is checked twice without being updated in between:

    result = smu7_init_voltage_dependency_on_display_clock_table(hwmgr);
    if (result)
        goto fail;

    ...

    if (result)
        goto fail;

The second check is redundant and unreachable for any new failure, since
no operation modifies "result" between the two checks. This triggers a
Smatch warning about a duplicate zero check and reduces code clarity.

Remove the stale error check to keep the control flow correct and
readable.

Fixes: 9f49e3d4cb86 ("drm/amd/pm/smu7: Remove non-functional SMU7 voltage dependency on DAL")
Reported-by: Dan Carpenter <error27@gmail.com>
Cc: Timur Kristóf <timur.kristof@gmail.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c

index 8c37aa452569544ba83a9a3c966141fc8844e00c..55e2375e1dad8664c63afdd38a20fb3bbf605a89 100644 (file)
@@ -3062,9 +3062,6 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
                smu7_set_private_data_based_on_pptable_v0(hwmgr);
        }
 
-       if (result)
-               goto fail;
-
        data->is_tlu_enabled = false;
 
        hwmgr->platform_descriptor.hardwareActivityPerformanceLevels =