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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxx>
---
 drivers/staging/etnaviv/etnaviv_gem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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);
-- 
2.1.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux