diff mbox series

drm/i915/phys: unconditionally call release_memory_region

Message ID 20200305204258.216302-1-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/phys: unconditionally call release_memory_region | expand

Commit Message

Matthew Auld March 5, 2020, 8:42 p.m. UTC
From: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>

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: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_phys.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Chris Wilson March 6, 2020, 10:05 a.m. UTC | #1
Quoting Patchwork (2020-03-06 06:09:52)
> == Series Details ==
> 
> Series: drm/i915/phys: unconditionally call release_memory_region
> URL   : https://patchwork.freedesktop.org/series/74354/
> State : success
> 
> == Summary ==
> 
> CI Bug Log - changes from CI_DRM_8074 -> Patchwork_16849
> ====================================================
> 
> Summary
> -------
> 
>   **SUCCESS**
> 
>   No regressions found.
> 
>   External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16849/index.html

Ok. This migration still looks ugly, but the patch looks correct.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_phys.c b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
index b07bb40edd5a..698e22420dc5 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_phys.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
@@ -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 */
 	__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_object_release_memory_region(obj);
-	}
+
+	i915_gem_object_release_memory_region(obj);
+
 	mutex_unlock(&obj->mm.lock);
 	return 0;