aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <[email protected]>2022-02-16 09:41:42 -0800
committerLucas De Marchi <[email protected]>2022-02-25 15:23:26 -0800
commit58fb284c52b6262b9bd43420aa39124c39e2342a (patch)
tree93e7c947c8c7508bd1db10f0daa54b13f056237a
parentd9a5696e7d52edf68776599f2a38b9aee1382be9 (diff)
drm/i915/guc: Replace check for golden context size
In the other places in this function, guc->ads_map is being protected from access when it's not yet set. However the last check is actually about guc->ads_golden_ctxt_size been set before. These checks should always match as the size is initialized on the first call to guc_prep_golden_context(), but it's clearer if we have a single return and check for guc->ads_golden_ctxt_size. This is just a readability improvement, no change in behavior. Cc: Matt Roper <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: John Harrison <[email protected]> Cc: Matthew Brost <[email protected]> Cc: Daniele Ceraolo Spurio <[email protected]> Signed-off-by: Lucas De Marchi <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
index 0077a63832ad..b739781bd133 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
@@ -500,10 +500,10 @@ static int guc_prep_golden_context(struct intel_guc *guc)
addr_ggtt += alloc_size;
}
- if (iosys_map_is_null(&guc->ads_map))
- return total_size;
+ /* Make sure current size matches what we calculated previously */
+ if (guc->ads_golden_ctxt_size)
+ GEM_BUG_ON(guc->ads_golden_ctxt_size != total_size);
- GEM_BUG_ON(guc->ads_golden_ctxt_size != total_size);
return total_size;
}