summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2024-06-26 23:35:41 +0200
committerAlex Deucher <alexander.deucher@amd.com>2024-07-01 22:06:52 +0200
commitb73581329adb9e8105277a463a4d1801868b22e7 (patch)
tree1994b48d17a7675fa4c2714713b200d15466f825 /drivers/gpu/drm/amd/display
parentdrm/amd: Don't initialize ISP hardware without FW (diff)
downloadlinux-b73581329adb9e8105277a463a4d1801868b22e7.tar.xz
linux-b73581329adb9e8105277a463a4d1801868b22e7.zip
drm/amd/display: use vmalloc for struct dc_state
This is a big structure so use vmalloc as malloc can fail when there is memory pressure. Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3454 Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 5d4f831b1e55..5442da90f508 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -23,6 +23,7 @@
*
*/
+#include <linux/vmalloc.h>
#include <drm/display/drm_dp_helper.h>
#include <drm/display/drm_dp_mst_helper.h>
#include <drm/drm_atomic.h>
@@ -1491,9 +1492,10 @@ int pre_validate_dsc(struct drm_atomic_state *state,
* from dm_state->context.
*/
- local_dc_state = kmemdup(dm_state->context, sizeof(struct dc_state), GFP_KERNEL);
+ local_dc_state = vmalloc(sizeof(struct dc_state));
if (!local_dc_state)
return -ENOMEM;
+ memcpy(local_dc_state, dm_state->context, sizeof(struct dc_state));
for (i = 0; i < local_dc_state->stream_count; i++) {
struct dc_stream_state *stream = dm_state->context->streams[i];
@@ -1563,7 +1565,7 @@ clean_exit:
dc_stream_release(local_dc_state->streams[i]);
}
- kfree(local_dc_state);
+ vfree(local_dc_state);
return ret;
}