Message ID | 20220915-stolen-v1-1-117c5f295bb2@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915: Improvements to stolen memory setup | expand |
On 16-09-2022 02:09, Lucas De Marchi wrote: > Reduce possible side effects of assigning the region and bailing out due > to errors. > > Signed-off-by: Lucas De Marchi <lucas.demarchi@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; assignment should be above the GEM_BUG_ON. but why don't you squash this into 3rd patch thanks, Aravind. > + > stolen_top = i915->dsm.end + 1; > reserved_base = stolen_top; > reserved_size = 0; >
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;
Reduce possible side effects of assigning the region and bailing out due to errors. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>