]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: fix NULL dereference
authorJosé Pekkarinen <jose.pekkarinen@foxhound.fi>
Tue, 14 Nov 2023 15:27:51 +0000 (17:27 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Nov 2023 05:50:33 +0000 (00:50 -0500)
The following patch will fix a minor issue where a debug message is
referencing an struct that has just being checked whether is null or
not. This has been noticed by using coccinelle, in the following output:

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c:540:25-29: ERROR: aconnector is NULL but dereferenced.

Fixes: 5d72e247e58c ("drm/amd/display: switch DC over to the new DRM logging macros")
Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c

index ed784cf27d396f10fe507a1a4a41a009f01e15a5..c7a29bb737e24d0394e770529f1d3f43d0333aae 100644 (file)
@@ -536,11 +536,8 @@ bool dm_helpers_dp_read_dpcd(
 
        struct amdgpu_dm_connector *aconnector = link->priv;
 
-       if (!aconnector) {
-               drm_dbg_dp(aconnector->base.dev,
-                          "Failed to find connector for link!\n");
+       if (!aconnector)
                return false;
-       }
 
        return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address, data,
                                size) == size;