Commit d903af1a authored by Chen Jiahao's avatar Chen Jiahao Committed by Alex Deucher

drm/amd/amdgpu: Use kmemdup to simplify kmalloc and memcpy logic

Using kmemdup() helper function rather than implementing it again
with kmalloc() + memcpy(), which improves the code readability.
Signed-off-by: default avatarChen Jiahao <chenjiahao16@huawei.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5465e7b8
...@@ -264,16 +264,9 @@ struct edid *amdgpu_connector_edid(struct drm_connector *connector) ...@@ -264,16 +264,9 @@ struct edid *amdgpu_connector_edid(struct drm_connector *connector)
static struct edid * static struct edid *
amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev) amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev)
{ {
struct edid *edid;
if (adev->mode_info.bios_hardcoded_edid) { if (adev->mode_info.bios_hardcoded_edid) {
edid = kmalloc(adev->mode_info.bios_hardcoded_edid_size, GFP_KERNEL); return kmemdup((unsigned char *)adev->mode_info.bios_hardcoded_edid,
if (edid) { adev->mode_info.bios_hardcoded_edid_size, GFP_KERNEL);
memcpy((unsigned char *)edid,
(unsigned char *)adev->mode_info.bios_hardcoded_edid,
adev->mode_info.bios_hardcoded_edid_size);
return edid;
}
} }
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment