diff mbox

[09/11] drm/i915: fixup execbuf failure path

Message ID 929126816da9516827b8850d4c0c4dcd08cf3587.1263558064.git.daniel.vetter@ffwll.ch (mailing list archive)
State Rejected
Headers show

Commit Message

Daniel Vetter Jan. 15, 2010, 12:24 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6bf4481..23fae9a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3718,7 +3718,7 @@  i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	struct drm_i915_gem_object *obj_priv;
 	struct drm_clip_rect *cliprects = NULL;
 	struct drm_i915_gem_relocation_entry *relocs;
-	int ret = 0, ret2, i, pinned = 0;
+	int ret = 0, ret2, i, pinned = 0, referenced;
 	uint64_t exec_offset;
 	uint32_t seqno, flush_domains, reloc_index;
 	int pin_tries, flips;
@@ -3787,6 +3787,7 @@  i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			DRM_ERROR("Invalid object handle %d at index %d\n",
 				   exec_list[i].handle, i);
 			ret = -EBADF;
+			referenced = i + 1;
 			goto err;
 		}
 
@@ -3795,11 +3796,13 @@  i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			DRM_ERROR("Object %p appears more than once in object list\n",
 				   object_list[i]);
 			ret = -EBADF;
+			referenced = i + 1;
 			goto err;
 		}
 		obj_priv->in_execbuffer = true;
 		flips += atomic_read(&obj_priv->pending_flip);
 	}
+	referenced = args->buffer_count;
 
 	if (flips > 0) {
 		ret = i915_gem_wait_for_pending_flip(dev, object_list,
@@ -3980,7 +3983,7 @@  err:
 	for (i = 0; i < pinned; i++)
 		i915_gem_object_unpin(object_list[i]);
 
-	for (i = 0; i < args->buffer_count; i++) {
+	for (i = 0; i < referenced; i++) {
 		if (object_list[i]) {
 			obj_priv = object_list[i]->driver_private;
 			obj_priv->in_execbuffer = false;