Skip to content

Commit

Permalink
drm/i915/gvt: Refine error handling for intel_vgpu_pin_mm
Browse files Browse the repository at this point in the history
When it is failed in shadow_mm, the pin_count should rollback
to the original states before return.

v2:
- split the mixed several error paths for better review. (Zhenyu)

v3:
  increase the pincount after shadow success. (Zhenyu)

Signed-off-by: fred gao <fred.gao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
  • Loading branch information
fred gao authored and Zhenyu Wang committed Sep 8, 2017
1 parent 0cce282 commit 46b441e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/gpu/drm/i915/gvt/gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1647,14 +1647,13 @@ int intel_vgpu_pin_mm(struct intel_vgpu_mm *mm)
if (WARN_ON(mm->type != INTEL_GVT_MM_PPGTT))
return 0;

atomic_inc(&mm->pincount);

if (!mm->shadowed) {
ret = shadow_mm(mm);
if (ret)
return ret;
}

atomic_inc(&mm->pincount);
list_del_init(&mm->lru_list);
list_add_tail(&mm->lru_list, &mm->vgpu->gvt->gtt.mm_lru_list_head);
return 0;
Expand Down

0 comments on commit 46b441e

Please sign in to comment.