summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-07-26 16:40:15 +0300
committerAlex Deucher <alexander.deucher@amd.com>2024-07-28 00:35:05 +0300
commitaeb81b62c7fe4782198e9dd79c7d6cdf04d92586 (patch)
tree0a7bdaeeac1d86c787f6ee4303c3bb2cfc79b8f8 /drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
parent608d886c978cd5f3d8650630568d96c231845227 (diff)
downloadlinux-aeb81b62c7fe4782198e9dd79c7d6cdf04d92586.tar.xz
drm/amdgpu: convert bios_hardcoded_edid to drm_edid
Instead of manually passing around 'struct edid *' and its size, use 'struct drm_edid', which encapsulates a validated combination of both. As the drm_edid_ can handle NULL gracefully, the explicit checks can be dropped. Also save a few characters by transforming '&array[0]' to the equivalent 'array' and using 'max_t(int, ...)' instead of manual casts. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/atombios_encoders.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/atombios_encoders.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
index ebf83fee43bb..8defca3705d5 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
@@ -2064,23 +2064,18 @@ amdgpu_atombios_encoder_get_lcd_info(struct amdgpu_encoder *encoder)
case LCD_FAKE_EDID_PATCH_RECORD_TYPE:
fake_edid_record = (ATOM_FAKE_EDID_PATCH_RECORD *)record;
if (fake_edid_record->ucFakeEDIDLength) {
- struct edid *edid;
+ const struct drm_edid *edid;
int edid_size;
if (fake_edid_record->ucFakeEDIDLength == 128)
edid_size = fake_edid_record->ucFakeEDIDLength;
else
edid_size = fake_edid_record->ucFakeEDIDLength * 128;
- edid = kmemdup(&fake_edid_record->ucFakeEDIDString[0],
- edid_size, GFP_KERNEL);
- if (edid) {
- if (drm_edid_is_valid(edid)) {
- adev->mode_info.bios_hardcoded_edid = edid;
- adev->mode_info.bios_hardcoded_edid_size = edid_size;
- } else {
- kfree(edid);
- }
- }
+ edid = drm_edid_alloc(fake_edid_record->ucFakeEDIDString, edid_size);
+ if (drm_edid_valid(edid))
+ adev->mode_info.bios_hardcoded_edid = edid;
+ else
+ drm_edid_free(edid);
record += struct_size(fake_edid_record,
ucFakeEDIDString,
edid_size);