]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Check NULL before accessing a variable
authorAlex Hung <alex.hung@amd.com>
Tue, 6 Jan 2026 16:42:26 +0000 (09:42 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 20 Jan 2026 22:19:34 +0000 (17:19 -0500)
[WHAT]
Check NULL before accessing link, not after.

This is reported as a REVERSE_INULL error by Coverity.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Matthew Stewart <matthew.stewart2@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/power/power_helpers.c

index 864002b63716647a296b531c54f1b82c308fe772..df3b8383b06dea2e1bce9778bfcb1c80b53661ac 100644 (file)
@@ -984,10 +984,13 @@ void set_replay_frame_skip_number(struct dc_link *link,
        uint32_t *frame_skip_number_array = NULL;
        uint32_t frame_skip_number = 0;
 
+       if (link == NULL)
+               return;
+
        if (false == link->replay_settings.config.frame_skip_supported)
                return;
 
-       if (link == NULL || flicker_free_refresh_rate_mhz == 0 || coasting_vtotal_refresh_rate_mhz == 0)
+       if (flicker_free_refresh_rate_mhz == 0 || coasting_vtotal_refresh_rate_mhz == 0)
                return;
 
        if (is_defer)