aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-06 09:44:14 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-06 18:09:49 -0400
commit1dfd9754cd55e424f247d9a2e855ad384e3e90ef (patch)
treecadde12a7cfc5ce67767af4d6405726666a50241 /drivers/gpu/drm
parente167976ee7f5fe4b80f7e8f55e087f6c67cf9562 (diff)
Revert "drm/i915: Unreference object not handle on creation"
This reverts commit 86f100b136626e91f4f66f3776303475e2e58998. The kref API requires the handlecount to be initialised to one on object creation (so that kref_get() doesn't complain upon first use) so the dalliance in the drivers is required in order to sink the initial floating reference. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: stable@kernel.org
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index df5a7135c261..68526f467c87 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -135,12 +135,15 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
135 return -ENOMEM; 135 return -ENOMEM;
136 136
137 ret = drm_gem_handle_create(file_priv, obj, &handle); 137 ret = drm_gem_handle_create(file_priv, obj, &handle);
138 drm_gem_object_unreference_unlocked(obj); 138 if (ret) {
139 if (ret) 139 drm_gem_object_unreference_unlocked(obj);
140 return ret; 140 return ret;
141 }
141 142
142 args->handle = handle; 143 /* Sink the floating reference from kref_init(handlecount) */
144 drm_gem_object_handle_unreference_unlocked(obj);
143 145
146 args->handle = handle;
144 return 0; 147 return 0;
145} 148}
146 149