Skip to content

Commit

Permalink
drm/i915/selftests: Release ctx->engine_mutex after iteration
Browse files Browse the repository at this point in the history
A lock once taken must be released again.

Fixes: c31c9e8 ("drm/i915/selftests: Teach switch_to_context() to use the context")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022223316.12662-1-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Oct 23, 2019
1 parent f79520b commit e16302c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/gpu/drm/i915/selftests/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@ static int switch_to_context(struct i915_gem_context *ctx)
{
struct i915_gem_engines_iter it;
struct intel_context *ce;
int err = 0;

for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it) {
struct i915_request *rq;

rq = intel_context_create_request(ce);
if (IS_ERR(rq))
return PTR_ERR(rq);
if (IS_ERR(rq)) {
err = PTR_ERR(rq);
break;
}

i915_request_add(rq);
}
i915_gem_context_unlock_engines(ctx);

return 0;
return err;
}

static void trash_stolen(struct drm_i915_private *i915)
Expand Down

0 comments on commit e16302c

Please sign in to comment.