]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/i915/gvt: Refine error handling in dispatch_workload
authorfred gao <fred.gao@intel.com>
Fri, 18 Aug 2017 07:41:10 +0000 (15:41 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Fri, 8 Sep 2017 06:21:15 +0000 (14:21 +0800)
When an error occurs in dispatch_workload, this patch is to do the
proper cleanup and rollback to the original states before the workload
is abandoned.

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

v3:
- original PTR_ERR(cs) is good and code cleanup. (Zhenyu)

v4:
- reuse the existing i915_add_request for error handling. (Zhenyu)

v5:
- remove the duplicate error handling release_shadow_wa_ctx and
  move the engine->context_unpin upper. (Zhenyu)

v6:
- keep the old label "out". (Zhenyu)

Signed-off-by: fred gao <fred.gao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/scheduler.c

index 29171961af5e8c2627ee30ec52f2c572dc0824f9..6fb9b589276d23779942bcb833b7b6dea61e2905 100644 (file)
@@ -342,8 +342,10 @@ static int dispatch_workload(struct intel_vgpu_workload *workload)
 
        if (workload->prepare) {
                ret = workload->prepare(workload);
-               if (ret)
+               if (ret) {
+                       engine->context_unpin(engine, shadow_ctx);
                        goto out;
+               }
        }
 
 out: