summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 202a6ac51c05..785e04c56171 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -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 *