summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/i915_drv.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-12-19 10:13:57 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-12-19 11:42:31 +0000
commitbf51997c91e097e552ce219f38c1520e4039b637 (patch)
tree2569bee340b7e5850ca8ff3e7bed186a6f90dd22 /drivers/gpu/drm/i915/i915_drv.h
parentf73e73999d39a274adb8b342d7d8e722ffcf92d5 (diff)
downloadlwn-bf51997c91e097e552ce219f38c1520e4039b637.tar.gz
lwn-bf51997c91e097e552ce219f38c1520e4039b637.zip
drm/i915: Drop mutex after successful kref_put_mutex()
The kref_put_mutex() returns with the mutex held after freeing the object - so we must remember to drop it... Fixes: 69df05e11ab8 ("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>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
-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 *