[Intel-gfx] [PATCH 3/3] drm/i915: reuse i915_gem_free_object in the create error path

Daniel Vetter daniel.vetter at ffwll.ch
Wed Jul 24 13:00:59 CEST 2013


Instead of partially duplicating code. This shouldn't ever cause a
problem since by the time we call drm_gem_handle_create we must be
able to handle the object destruction any time (e.g. when userspace
races a concurrent gem close ioctl call).

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8020154..5663a22 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -191,7 +191,6 @@ i915_gem_create(struct drm_file *file,
 		uint32_t *handle_p)
 {
 	struct drm_i915_gem_object *obj;
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret;
 	u32 handle;
 
@@ -206,9 +205,7 @@ i915_gem_create(struct drm_file *file,
 
 	ret = drm_gem_handle_create(file, &obj->base, &handle);
 	if (ret) {
-		drm_gem_object_release(&obj->base);
-		atomic_dec(&dev_priv->mm.object_count);
-		i915_gem_object_free(obj);
+		i915_gem_free_object(&obj->base);
 		return ret;
 	}
 
-- 
1.8.1.4




More information about the Intel-gfx mailing list