[Intel-gfx] [PATCH 4/4] drm/i915: tidy up initialisation failure paths (GEM & LRC)
Nick Hoath
nicholas.hoath at intel.com
Thu Dec 17 03:37:57 PST 2015
On 16/12/2015 18:36, Gordon, David S wrote:
> 1. add call to i915_gem_context_fini() to deallocate the default
> context(s) if the call to init_rings() fails, so that we don't
> leak the context in that situation.
>
> 2. remove useless code in intel_logical_ring_cleanup(), presumably
> copypasted from legacy ringbuffer version at creation.
>
Reviewed-by: Nick Hoath <nicholas.hoath at intel.com>
> Signed-off-by: Dave Gordon <david.s.gordon at intel.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 5 ++++-
> drivers/gpu/drm/i915/intel_lrc.c | 10 ++--------
> 2 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 66b1705..15f8989 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4890,8 +4890,11 @@ int i915_gem_init(struct drm_device *dev)
> goto out_unlock;
>
> ret = dev_priv->gt.init_rings(dev);
> - if (ret)
> + if (ret) {
> + i915_gem_context_fini(dev);
> + /* XXX: anything else to be undone here? */
> goto out_unlock;
> + }
>
> ret = i915_gem_init_hw(dev);
> if (ret == -EIO) {
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 23f90b2..cdb65eb 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1887,17 +1887,11 @@ static int gen8_init_rcs_context(struct drm_i915_gem_request *req)
> */
> void intel_logical_ring_cleanup(struct intel_engine_cs *ring)
> {
> - struct drm_i915_private *dev_priv;
> -
> if (!intel_ring_initialized(ring))
> return;
>
> - dev_priv = ring->dev->dev_private;
> -
> - if (ring->buffer) {
> - intel_logical_ring_stop(ring);
> - WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0);
> - }
> + /* should not be set in LRC mode */
> + WARN_ON(ring->buffer);
>
> if (ring->cleanup)
> ring->cleanup(ring);
>
More information about the Intel-gfx
mailing list