Commit 24943269 authored by Qiang Yu's avatar Qiang Yu

drm/lima: check vm != NULL in lima_vm_put

No need to handle this check before calling lima_vm_put.
Tested-by: default avatarBhushan Shah <bshah@kde.org>
Reviewed-by: default avatarVasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: default avatarQiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200421133551.31481-4-yuq825@gmail.com
parent d04f2a8e
...@@ -252,7 +252,6 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job) ...@@ -252,7 +252,6 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job)
lima_mmu_switch_vm(pipe->mmu[i], vm); lima_mmu_switch_vm(pipe->mmu[i], vm);
} }
if (last_vm)
lima_vm_put(last_vm); lima_vm_put(last_vm);
trace_lima_task_run(task); trace_lima_task_run(task);
...@@ -416,9 +415,7 @@ static void lima_sched_timedout_job(struct drm_sched_job *job) ...@@ -416,9 +415,7 @@ static void lima_sched_timedout_job(struct drm_sched_job *job)
lima_mmu_page_fault_resume(pipe->mmu[i]); lima_mmu_page_fault_resume(pipe->mmu[i]);
} }
if (pipe->current_vm)
lima_vm_put(pipe->current_vm); lima_vm_put(pipe->current_vm);
pipe->current_vm = NULL; pipe->current_vm = NULL;
pipe->current_task = NULL; pipe->current_task = NULL;
......
...@@ -54,6 +54,7 @@ static inline struct lima_vm *lima_vm_get(struct lima_vm *vm) ...@@ -54,6 +54,7 @@ static inline struct lima_vm *lima_vm_get(struct lima_vm *vm)
static inline void lima_vm_put(struct lima_vm *vm) static inline void lima_vm_put(struct lima_vm *vm)
{ {
if (vm)
kref_put(&vm->refcount, lima_vm_release); kref_put(&vm->refcount, lima_vm_release);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment