Commit 64dc802a authored by Abdiel Janulgue's avatar Abdiel Janulgue Committed by Chris Wilson

drm/i915/phys: unconditionally call release_memory_region

The release method will undo what we did at creation, and so we
shouldn't care if we have pages or not. Fixes a small leak in the
mock_phys selftest.
Signed-off-by: default avatarAbdiel Janulgue <abdiel.janulgue@linux.intel.com>
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200305204258.216302-1-matthew.auld@intel.com
parent 47f8253d
...@@ -194,10 +194,11 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align) ...@@ -194,10 +194,11 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align)
/* Perma-pin (until release) the physical set of pages */ /* Perma-pin (until release) the physical set of pages */
__i915_gem_object_pin_pages(obj); __i915_gem_object_pin_pages(obj);
if (!IS_ERR_OR_NULL(pages)) { if (!IS_ERR_OR_NULL(pages))
i915_gem_shmem_ops.put_pages(obj, pages); i915_gem_shmem_ops.put_pages(obj, pages);
i915_gem_object_release_memory_region(obj); i915_gem_object_release_memory_region(obj);
}
mutex_unlock(&obj->mm.lock); mutex_unlock(&obj->mm.lock);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment