[Intel-gfx] [PATCH 44/66] drm/i915: Catch missed context unref earlier
Ben Widawsky
ben at bwidawsk.net
Fri Jun 28 01:30:45 CEST 2013
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
drivers/gpu/drm/i915/i915_drv.h | 4 ++--
drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f17d825..bead414 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1900,9 +1900,9 @@ static inline void i915_gem_context_reference(struct i915_hw_context *ctx)
kref_get(&ctx->ref);
}
-static inline void i915_gem_context_unreference(struct i915_hw_context *ctx)
+static inline int i915_gem_context_unreference(struct i915_hw_context *ctx)
{
- kref_put(&ctx->ref, i915_gem_context_free);
+ return kref_put(&ctx->ref, i915_gem_context_free);
}
struct i915_ctx_hang_stats * __must_check
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index c45cd5c..9176559 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -299,7 +299,7 @@ void i915_gem_context_fini(struct drm_device *dev)
}
i915_gem_object_unpin(dctx->obj);
- i915_gem_context_unreference(dctx);
+ WARN_ON(!i915_gem_context_unreference(dctx));
dev_priv->ring[RCS].default_context = NULL;
dev_priv->ring[RCS].last_context = NULL;
dev_priv->gtt.aliasing_ppgtt = NULL;
--
1.8.3.1
More information about the Intel-gfx
mailing list