All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Drop mutex after successful kref_put_mutex()
@ 2016-12-19 10:13 Chris Wilson
  2016-12-19 11:15 ` ✗ Fi.CI.BAT: warning for " Patchwork
  2016-12-19 11:38 ` [PATCH] " Joonas Lahtinen
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2016-12-19 10:13 UTC (permalink / raw)
  To: intel-gfx

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>
---
 drivers/gpu/drm/i915/i915_drv.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ff58583ea757..68b8bf16de57 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3519,9 +3519,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 *
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-19 11:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 10:13 [PATCH] drm/i915: Drop mutex after successful kref_put_mutex() Chris Wilson
2016-12-19 11:15 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-12-19 11:38 ` [PATCH] " Joonas Lahtinen
2016-12-19 11:50   ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.