aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0025-drm-amdgpu-handle-error-case-for-ctx.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/files/0025-drm-amdgpu-handle-error-case-for-ctx.patch')
-rw-r--r--common/recipes-kernel/linux/files/0025-drm-amdgpu-handle-error-case-for-ctx.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0025-drm-amdgpu-handle-error-case-for-ctx.patch b/common/recipes-kernel/linux/files/0025-drm-amdgpu-handle-error-case-for-ctx.patch
new file mode 100644
index 00000000..55da8d0f
--- /dev/null
+++ b/common/recipes-kernel/linux/files/0025-drm-amdgpu-handle-error-case-for-ctx.patch
@@ -0,0 +1,46 @@
+From b94cbc431148d3dc4b5bf20303412ed3b6e60f53 Mon Sep 17 00:00:00 2001
+From: Chunming Zhou <David1.Zhou@amd.com>
+Date: Thu, 10 Dec 2015 15:50:02 +0800
+Subject: [PATCH 0025/1110] drm/amdgpu: handle error case for ctx
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Properly handle ctx init failure.
+
+Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+index c1f2308..15e3416 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+@@ -56,7 +56,6 @@ int amdgpu_ctx_init(struct amdgpu_device *adev, enum amd_sched_priority pri,
+ for (j = 0; j < i; j++)
+ amd_sched_entity_fini(&adev->rings[j]->sched,
+ &ctx->rings[j].entity);
+- kfree(ctx);
+ return r;
+ }
+ }
+@@ -103,8 +102,12 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
+ }
+ *id = (uint32_t)r;
+ r = amdgpu_ctx_init(adev, AMD_SCHED_PRIORITY_NORMAL, ctx);
++ if (r) {
++ idr_remove(&mgr->ctx_handles, *id);
++ *id = 0;
++ kfree(ctx);
++ }
+ mutex_unlock(&mgr->lock);
+-
+ return r;
+ }
+
+--
+2.7.4
+