diff mbox

[RFC,036/111] staging: etnaviv: ensure cleanup of reservation object

Message ID 1427988653-754-37-git-send-email-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach April 2, 2015, 3:29 p.m. UTC
From: Russell King <rmk+kernel@arm.linux.org.uk>

The embedded reservation object is always initialised whenever we create
an etnaviv buffer object, but it is not always cleaned up.  Arrange this
to be clearer: always initialise the embedded reservation object
directly, and always clean the embedded reservation object up when
removing a buffer object.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_gem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c
index 827622588ffc..824338e0068d 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.c
+++ b/drivers/staging/etnaviv/etnaviv_gem.c
@@ -544,9 +544,6 @@  static void etnaviv_free_obj(struct drm_gem_object *obj)
 	drm_gem_free_mmap_offset(obj);
 
 	etnaviv_obj->ops->release(etnaviv_obj);
-
-	if (etnaviv_obj->resv == &etnaviv_obj->_resv)
-		reservation_object_fini(etnaviv_obj->resv);
 }
 
 static void etnaviv_gem_shmem_release(struct etnaviv_gem_object *etnaviv_obj)
@@ -577,6 +574,7 @@  void etnaviv_gem_free_object(struct drm_gem_object *obj)
 	else
 		etnaviv_free_obj(obj);
 
+	reservation_object_fini(&etnaviv_obj->_resv);
 	drm_gem_object_release(obj);
 
 	kfree(etnaviv_obj);
@@ -656,7 +654,7 @@  static int etnaviv_gem_new_impl(struct drm_device *dev,
 	etnaviv_obj->flags = flags;
 
 	etnaviv_obj->resv = &etnaviv_obj->_resv;
-	reservation_object_init(etnaviv_obj->resv);
+	reservation_object_init(&etnaviv_obj->_resv);
 
 	INIT_LIST_HEAD(&etnaviv_obj->submit_entry);
 	list_add_tail(&etnaviv_obj->mm_list, &priv->inactive_list);