drm/amd/display: Check null pointers before using them
authorAlex Hung <alex.hung@amd.com>
Mon, 15 Jul 2024 16:24:58 +0000 (10:24 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Sat, 27 Jul 2024 21:31:52 +0000 (17:31 -0400)
[WHAT & HOW]
dc_link is null checked previously in the same function, indicating it
might be null as reported by Coverity.

This fixes 1 FORWARD_NULL issue reported by Coverity.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 42ca9b5..b765798 100644 (file)
@@ -12083,7 +12083,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
                }
        }
 
-       as_type = dm_get_adaptive_sync_support_type(amdgpu_dm_connector->dc_link);
+       if (amdgpu_dm_connector->dc_link)
+               as_type = dm_get_adaptive_sync_support_type(amdgpu_dm_connector->dc_link);
 
        if (as_type == FREESYNC_TYPE_PCON_IN_WHITELIST) {
                i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, &vsdb_info);