Instead of manually calculating the EDID block count by reading the extensions field from the raw edid structure (`edid->extensions + 1`), utilize the core DRM helper `drm_edid_block_count()`.
This now includes possible HF-EEODB extension blocks, which are not included in `edid->extensions` and were previously truncated with the `memmove`. Signed-off-by: Timo Prömer <[email protected]> --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index c6f94eb71..ac5a3b337 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -1160,6 +1160,7 @@ enum dc_edid_status dm_helpers_read_local_edid( struct drm_connector *connector = &aconnector->base; struct i2c_adapter *ddc; int retry = 25; + int block_count; enum dc_edid_status edid_status = EDID_NO_RESPONSE; const struct drm_edid *drm_edid; const struct edid *edid; @@ -1205,7 +1206,9 @@ enum dc_edid_status dm_helpers_read_local_edid( edid->extensions >= sizeof(sink->dc_edid.raw_edid) / EDID_LENGTH) return EDID_BAD_INPUT; - sink->dc_edid.length = EDID_LENGTH * (edid->extensions + 1); + block_count = drm_edid_block_count(drm_edid); + + sink->dc_edid.length = EDID_LENGTH * block_count; memmove(sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); /* We don't need the original edid anymore */ -- 2.55.0
