[PATCH 09/10] drm/i915/guc: Replace conditional teardown with asserts

Michał Winiarski michal.winiarski at intel.com
Tue Jul 17 16:41:26 UTC 2018


Now that we've ordered the teardown correctly, we can replace the
conditionals with asserts, to make sure that the teardown sequence won't
degenerate over time.

Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
---
 drivers/gpu/drm/i915/intel_guc_submission.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
index af7828a50924..fc1b28188b09 100644
--- a/drivers/gpu/drm/i915/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/intel_guc_submission.c
@@ -912,11 +912,10 @@ static void guc_clients_doorbell_fini(struct intel_guc *guc)
 				       GUC_DOORBELL_INVALID);
 	}
 
-	if (guc->execbuf_client) {
-		__destroy_doorbell(guc->execbuf_client);
-		__update_doorbell_desc(guc->execbuf_client,
-				       GUC_DOORBELL_INVALID);
-	}
+	GEM_BUG_ON(!guc->execbuf_client);
+	__destroy_doorbell(guc->execbuf_client);
+	__update_doorbell_desc(guc->execbuf_client,
+			       GUC_DOORBELL_INVALID);
 }
 
 /**
@@ -1129,8 +1128,8 @@ static void guc_clients_destroy(struct intel_guc *guc)
 		guc_client_free(client);
 
 	client = fetch_and_zero(&guc->execbuf_client);
-	if (client)
-		guc_client_free(client);
+	GEM_BUG_ON(!client);
+	guc_client_free(client);
 }
 
 /*
@@ -1185,8 +1184,8 @@ void intel_guc_submission_fini(struct intel_guc *guc)
 	guc_clients_destroy(guc);
 	WARN_ON(!guc_verify_doorbells(guc));
 
-	if (guc->stage_desc_pool)
-		guc_stage_desc_pool_destroy(guc);
+	GEM_BUG_ON(!guc->stage_desc_pool);
+	guc_stage_desc_pool_destroy(guc);
 }
 
 static void guc_interrupts_capture(struct drm_i915_private *dev_priv)
-- 
2.17.1



More information about the Intel-gfx-trybot mailing list