diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/ce2_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c index a69cce0c..8ea0b2d5 100644 --- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | |||
@@ -186,20 +186,24 @@ static void gk20a_ce_free_command_buffer_stored_fence(struct gk20a_gpu_ctx *ce_c | |||
186 | /* assume this api should need to call under mutex_lock(&ce_app->app_mutex) */ | 186 | /* assume this api should need to call under mutex_lock(&ce_app->app_mutex) */ |
187 | static void gk20a_ce_delete_gpu_context(struct gk20a_gpu_ctx *ce_ctx) | 187 | static void gk20a_ce_delete_gpu_context(struct gk20a_gpu_ctx *ce_ctx) |
188 | { | 188 | { |
189 | struct list_head *list = &ce_ctx->list; | ||
190 | |||
189 | ce_ctx->gpu_ctx_state = NVGPU_CE_GPU_CTX_DELETED; | 191 | ce_ctx->gpu_ctx_state = NVGPU_CE_GPU_CTX_DELETED; |
190 | 192 | ||
191 | mutex_lock(&ce_ctx->gpu_ctx_mutex); | 193 | mutex_lock(&ce_ctx->gpu_ctx_mutex); |
192 | 194 | ||
193 | gk20a_ce_free_command_buffer_stored_fence(ce_ctx); | 195 | if (ce_ctx->cmd_buf_mem.cpu_va) { |
194 | 196 | gk20a_ce_free_command_buffer_stored_fence(ce_ctx); | |
195 | gk20a_gmmu_unmap_free(ce_ctx->vm, &ce_ctx->cmd_buf_mem); | 197 | gk20a_gmmu_unmap_free(ce_ctx->vm, &ce_ctx->cmd_buf_mem); |
198 | } | ||
196 | 199 | ||
197 | /* free the channel */ | 200 | /* free the channel */ |
198 | if (ce_ctx->ch) | 201 | if (ce_ctx->ch) |
199 | gk20a_channel_close(ce_ctx->ch); | 202 | gk20a_channel_close(ce_ctx->ch); |
200 | 203 | ||
201 | /* housekeeping on app */ | 204 | /* housekeeping on app */ |
202 | list_del(&ce_ctx->list); | 205 | if (list->prev && list->next) |
206 | list_del(list); | ||
203 | 207 | ||
204 | mutex_unlock(&ce_ctx->gpu_ctx_mutex); | 208 | mutex_unlock(&ce_ctx->gpu_ctx_mutex); |
205 | mutex_destroy(&ce_ctx->gpu_ctx_mutex); | 209 | mutex_destroy(&ce_ctx->gpu_ctx_mutex); |