diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 400c66ba4c6b..cf0500671353 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -135,15 +135,11 @@ static int amdgpu_ctx_free(struct amdgpu_fpriv *fpriv, uint32_t id) | |||
135 | struct amdgpu_ctx *ctx; | 135 | struct amdgpu_ctx *ctx; |
136 | 136 | ||
137 | mutex_lock(&mgr->lock); | 137 | mutex_lock(&mgr->lock); |
138 | ctx = idr_find(&mgr->ctx_handles, id); | 138 | ctx = idr_remove(&mgr->ctx_handles, id); |
139 | if (ctx) { | 139 | if (ctx) |
140 | idr_remove(&mgr->ctx_handles, id); | ||
141 | kref_put(&ctx->refcount, amdgpu_ctx_do_release); | 140 | kref_put(&ctx->refcount, amdgpu_ctx_do_release); |
142 | mutex_unlock(&mgr->lock); | ||
143 | return 0; | ||
144 | } | ||
145 | mutex_unlock(&mgr->lock); | 141 | mutex_unlock(&mgr->lock); |
146 | return -EINVAL; | 142 | return ctx ? 0 : -EINVAL; |
147 | } | 143 | } |
148 | 144 | ||
149 | static int amdgpu_ctx_query(struct amdgpu_device *adev, | 145 | static int amdgpu_ctx_query(struct amdgpu_device *adev, |