Skip to content

Commit

Permalink
drm/i915: Drop mutex after successful kref_put_mutex()
Browse files Browse the repository at this point in the history
The kref_put_mutex() returns with the mutex held after freeing the
object - so we must remember to drop it...

Fixes: 69df05e ("drm/i915: Simplify releasing context reference")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161219101357.28140-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
  • Loading branch information
Chris Wilson committed Dec 19, 2016
1 parent f73e739 commit bf51997
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3520,9 +3520,10 @@ static inline void i915_gem_context_put(struct i915_gem_context *ctx)

static inline void i915_gem_context_put_unlocked(struct i915_gem_context *ctx)
{
kref_put_mutex(&ctx->ref,
i915_gem_context_free,
&ctx->i915->drm.struct_mutex);
struct mutex *lock = &ctx->i915->drm.struct_mutex;

if (kref_put_mutex(&ctx->ref, i915_gem_context_free, lock))
mutex_unlock(lock);
}

static inline struct intel_timeline *
Expand Down

0 comments on commit bf51997

Please sign in to comment.