diff options
| author | Chen Jiahao <[email protected]> | 2023-08-16 02:19:58 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2023-08-30 18:56:47 +0000 |
| commit | d903af1a918fa1be628ad9c2a4412293c861cd6c (patch) | |
| tree | b48ed759203b462ef4af76396f6e43a1c710ec81 /drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | |
| parent | drm/amdgpu/pm: Add notification for no DC support (diff) | |
| download | kernel-d903af1a918fa1be628ad9c2a4412293c861cd6c.tar.gz kernel-d903af1a918fa1be628ad9c2a4412293c861cd6c.zip | |
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: Chen Jiahao <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index d34037b85cf8..7473a42f7d45 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -264,16 +264,9 @@ struct edid *amdgpu_connector_edid(struct drm_connector *connector) static struct edid * amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev) { - struct edid *edid; - if (adev->mode_info.bios_hardcoded_edid) { - edid = kmalloc(adev->mode_info.bios_hardcoded_edid_size, GFP_KERNEL); - if (edid) { - memcpy((unsigned char *)edid, - (unsigned char *)adev->mode_info.bios_hardcoded_edid, - adev->mode_info.bios_hardcoded_edid_size); - return edid; - } + return kmemdup((unsigned char *)adev->mode_info.bios_hardcoded_edid, + adev->mode_info.bios_hardcoded_edid_size, GFP_KERNEL); } return NULL; } |
