public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: deepak.s@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2] drm/i915: Clean-up idr table if context create fails.
Date: Thu,  2 Apr 2015 18:52:34 +0530	[thread overview]
Message-ID: <1427980954-15015-1-git-send-email-deepak.s@linux.intel.com> (raw)
In-Reply-To: <551D41EA.20307@linux.intel.com>

From: Deepak S <deepak.s@linux.intel.com>

Cleanup idr table if any error happens after __create_hw_context() in
i915_gem_create_context()

v2: add a new err_idr (Daniel)

Signed-off-by: Deepak S <deepak.s@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index f3e84c4..9b425a3 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -262,7 +262,7 @@ i915_gem_create_context(struct drm_device *dev,
 					    get_context_alignment(dev), 0);
 		if (ret) {
 			DRM_DEBUG_DRIVER("Couldn't pin %d\n", ret);
-			goto err_destroy;
+			goto err_idr;
 		}
 	}
 
@@ -286,7 +286,9 @@ i915_gem_create_context(struct drm_device *dev,
 err_unpin:
 	if (is_global_default_ctx && ctx->legacy_hw_ctx.rcs_state)
 		i915_gem_object_ggtt_unpin(ctx->legacy_hw_ctx.rcs_state);
-err_destroy:
+err_idr:
+	if (ctx->file_priv)
+		idr_remove(&ctx->file_priv->context_idr, ctx->user_handle);
 	i915_gem_context_unreference(ctx);
 	return ERR_PTR(ret);
 }
-- 
1.9.1

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

  reply	other threads:[~2015-04-02 13:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 14:33 [PATCH] drm/i915: Clean-up idr table if context create fails deepak.s
2015-03-30 15:43 ` Daniel Vetter
2015-04-02 13:19   ` Deepak S
2015-04-02 13:22     ` deepak.s [this message]
2015-04-02 23:00       ` [PATCH v2] " shuang.he
2015-04-07  8:20     ` [PATCH] " Daniel Vetter
2015-04-07  8:32       ` Chris Wilson
2015-04-07 15:11         ` Deepak S
2015-03-30 17:06 ` shuang.he

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427980954-15015-1-git-send-email-deepak.s@linux.intel.com \
    --to=deepak.s@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox