]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gvt: Refine error handling for intel_vgpu_pin_mm
authorfred gao <fred.gao@intel.com>
Fri, 18 Aug 2017 07:41:09 +0000 (15:41 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Fri, 8 Sep 2017 06:21:15 +0000 (14:21 +0800)
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>
drivers/gpu/drm/i915/gvt/gtt.c

index e6dfc3331f4bb4687c405e7ce1a4999d8322fabe..0bd028f8fef532b27e4093a9f1712a92bbab965c 100644 (file)
@@ -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;