diff options
author | Chunming Zhou <David1.Zhou@amd.com> | 2015-12-10 07:50:02 (GMT) |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-12-15 00:42:11 (GMT) |
commit | c648ed7c5c7f0e3bb4ab11bf08bccf99b42a4cbb (patch) | |
tree | a795fe668e3c3459ecf53cc5823ee09b41e8c8e2 /drivers | |
parent | e8deea2d4bb441751a4c1730495fa9810a208de5 (diff) | |
download | linux-c648ed7c5c7f0e3bb4ab11bf08bccf99b42a4cbb.tar.xz |
drm/amdgpu: handle error case for ctx
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 7 |
1 files 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; } |