Commit fbaa1229 authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915/selftests: Take an explicit ref for rq->batch

Since we are peeking into the batch object of the request, it is
beholden on us to hold a reference to it.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/1634


Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200408091723.28937-1-chris@chris-wilson.co.uk
parent dd345efe
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2655,7 +2655,7 @@ static int create_gang(struct intel_engine_cs *engine,
	if (IS_ERR(rq))
		goto err_obj;

	rq->batch = vma;
	rq->batch = i915_vma_get(vma);
	i915_request_get(rq);

	i915_vma_lock(vma);
@@ -2679,6 +2679,7 @@ static int create_gang(struct intel_engine_cs *engine,
	return 0;

err_rq:
	i915_vma_put(rq->batch);
	i915_request_put(rq);
err_obj:
	i915_gem_object_put(obj);
@@ -2775,6 +2776,7 @@ static int live_preempt_gang(void *arg)
				err = -ETIME;
			}

			i915_vma_put(rq->batch);
			i915_request_put(rq);
			rq = n;
		}