@@ -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
@@ -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;
Signed-off-by: Ben Widawsky <ben@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(-)