From 0f43702a334b2848ae2e942dbc0677ddc4566b57 Mon Sep 17 00:00:00 2001
From: fred gao <fred.gao@intel.com>
Date: Fri, 18 Aug 2017 15:41:10 +0800
Subject: [PATCH] drm/i915/gvt: Refine error handling in dispatch_workload
Git-commit: 0f43702a334b2848ae2e942dbc0677ddc4566b57
Patch-mainline: v4.15-rc1
References: FATE#322643 bsc#1055900
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>
Acked-by: Takashi Iwai <tiwai@suse.de>
---
drivers/gpu/drm/i915/gvt/scheduler.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/i915/gvt/scheduler.c
+++ b/drivers/gpu/drm/i915/gvt/scheduler.c
@@ -342,8 +342,10 @@ static int dispatch_workload(struct inte
if (workload->prepare) {
ret = workload->prepare(workload);
- if (ret)
+ if (ret) {
+ engine->context_unpin(engine, shadow_ctx);
goto out;
+ }
}
out: