drm/amd/display: use a more accurate check in dm_helpers_dp_read_dpcd()
authorHamza Mahfooz <hamza.mahfooz@amd.com>
Wed, 8 Mar 2023 21:14:08 +0000 (16:14 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 Mar 2023 21:27:49 +0000 (17:27 -0400)
We should be checking if drm_dp_dpcd_read() returns the size that we are
asking it to read instead of just checking if it is greater than zero.
So, compare the return value of drm_dp_dpcd_read() to the requested
read size.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
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 8d598b3..9c1e91c 100644 (file)
@@ -511,8 +511,8 @@ bool dm_helpers_dp_read_dpcd(
                return false;
        }
 
                return false;
        }
 
-       return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address,
-                       data, size) > 0;
+       return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address, data,
+                               size) == size;
 }
 
 bool dm_helpers_dp_write_dpcd(
 }
 
 bool dm_helpers_dp_write_dpcd(