[Intel-gfx] [PATCH v1 1/4] drm/i915: Move dsm assignment to be after adjustment

Lucas De Marchi lucas.demarchi at intel.com
Thu Sep 15 20:39:05 UTC 2022


Reduce possible side effects of assigning the region and bailing out due
to errors.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
index acc561c0f0aa..42f4769bb4ac 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -418,14 +418,14 @@ static int i915_gem_init_stolen(struct intel_memory_region *mem)
 	if (resource_size(&mem->region) == 0)
 		return 0;
 
-	i915->dsm = mem->region;
-
-	if (i915_adjust_stolen(i915, &i915->dsm))
+	if (i915_adjust_stolen(i915, &mem->region))
 		return 0;
 
 	GEM_BUG_ON(i915->dsm.start == 0);
 	GEM_BUG_ON(i915->dsm.end <= i915->dsm.start);
 
+	i915->dsm = mem->region;
+
 	stolen_top = i915->dsm.end + 1;
 	reserved_base = stolen_top;
 	reserved_size = 0;

-- 
b4 0.10.0-dev-bbe61


More information about the Intel-gfx mailing list