All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 15/20] drm/i915/ringbuffer: Set ring->gem_buffer = NULL on init unwind
Date: Sat,  7 Aug 2010 11:01:34 +0100	[thread overview]
Message-ID: <1281175299-1379-16-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1281175299-1379-1-git-send-email-chris@chris-wilson.co.uk>

The cleanup path for early abort failed to nullify the gem_buffer. The
likely consequence of this is zero, since a failure here should mean
aborting the module load.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 3a02425..7823b96 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -608,9 +608,10 @@ err:
 int intel_init_ring_buffer(struct drm_device *dev,
 		struct intel_ring_buffer *ring)
 {
-	int ret;
 	struct drm_i915_gem_object *obj_priv;
 	struct drm_gem_object *obj;
+	int ret;
+
 	ring->dev = dev;
 
 	if (I915_NEED_GFX_HWS(dev)) {
@@ -623,16 +624,14 @@ int intel_init_ring_buffer(struct drm_device *dev,
 	if (obj == NULL) {
 		DRM_ERROR("Failed to allocate ringbuffer\n");
 		ret = -ENOMEM;
-		goto cleanup;
+		goto err_hws;
 	}
 
 	ring->gem_object = obj;
 
 	ret = i915_gem_object_pin(obj, ring->alignment);
-	if (ret != 0) {
-		drm_gem_object_unreference(obj);
-		goto cleanup;
-	}
+	if (ret)
+		goto err_unref;
 
 	obj_priv = to_intel_bo(obj);
 	ring->map.size = ring->size;
@@ -644,18 +643,14 @@ int intel_init_ring_buffer(struct drm_device *dev,
 	drm_core_ioremap_wc(&ring->map, dev);
 	if (ring->map.handle == NULL) {
 		DRM_ERROR("Failed to map ringbuffer.\n");
-		i915_gem_object_unpin(obj);
-		drm_gem_object_unreference(obj);
 		ret = -EINVAL;
-		goto cleanup;
+		goto err_unpin;
 	}
 
 	ring->virtual_start = ring->map.handle;
 	ret = ring->init(dev, ring);
-	if (ret != 0) {
-		intel_cleanup_ring_buffer(dev, ring);
-		return ret;
-	}
+	if (ret)
+		goto err_unmap;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		i915_kernel_lost_context(dev);
@@ -669,7 +664,15 @@ int intel_init_ring_buffer(struct drm_device *dev,
 	INIT_LIST_HEAD(&ring->active_list);
 	INIT_LIST_HEAD(&ring->request_list);
 	return ret;
-cleanup:
+
+err_unmap:
+	drm_core_ioremapfree(&ring->map, dev);
+err_unpin:
+	i915_gem_object_unpin(obj);
+err_unref:
+	drm_gem_object_unreference(obj);
+	ring->gem_object = NULL;
+err_hws:
 	cleanup_status_page(dev, ring);
 	return ret;
 }
-- 
1.7.1

  parent reply	other threads:[~2010-08-07 10:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-07 10:01 Rebased series on drm-intel-next Chris Wilson
2010-08-07 10:01 ` [PATCH 01/20] drm/i915: Append the object onto the inactive list on binding Chris Wilson
2010-08-07 10:01 ` [PATCH 02/20] drm/i915: prepare for fair lru eviction Chris Wilson
2010-08-07 10:01 ` [PATCH 03/20] drm/i915: Use a common seqno for all rings Chris Wilson
2010-08-07 10:01 ` [PATCH 04/20] drm/i915: Move the eviction logic to its own file Chris Wilson
2010-08-07 10:01 ` [PATCH 05/20] drm/i915: Implement fair lru eviction across both rings. (v2) Chris Wilson
2010-08-07 10:01 ` [PATCH 06/20] drm/i915: Maintain LRU order of inactive objects upon access by CPU Chris Wilson
2010-08-07 19:34   ` Daniel Vetter
2010-08-07 20:45     ` [PATCH] drm/i915: Maintain LRU order of inactive objects upon access by CPU (v2) Chris Wilson
2010-08-07 10:01 ` [PATCH 07/20] drm/i915: Record error batch buffers using iomem Chris Wilson
2010-08-07 10:01 ` [PATCH 08/20] drm/i915/sdvo: Markup a few constant strings Chris Wilson
2010-08-07 10:01 ` [PATCH 09/20] drm/i915: Enable aspect/centering panel fitting for Ironlake Chris Wilson
2010-08-07 10:01 ` [PATCH 10/20] drm/i915: Write to display base last Chris Wilson
2010-08-07 10:01 ` [PATCH 11/20] drm/i915: Truncate the shmem backing pages on purge Chris Wilson
2010-08-07 10:01 ` [PATCH 12/20] drm/i915/display: Add pipe/plane information to dpms debugging Chris Wilson
2010-08-07 10:01 ` [PATCH 13/20] drm/i915/opregion: Use ASLE response codes defined in 0.1 Chris Wilson
2010-08-07 10:01 ` [PATCH 14/20] drm/i915: Update watermarks for Ironlake after dpms changes Chris Wilson
2010-08-07 10:01 ` Chris Wilson [this message]
2010-08-07 10:01 ` [PATCH 16/20] drm/i915: Ensure that while(INREG()) are bounded (v2) Chris Wilson
2010-09-21 14:22   ` Carlos R. Mafra
2010-09-21 14:35     ` Chris Wilson
2010-09-21 15:55       ` Jesse Barnes
2010-09-22  8:32         ` Carlos R. Mafra
2010-09-22  8:43           ` Chris Wilson
2010-09-22 10:48             ` Carlos R. Mafra
2010-09-22 10:57               ` Chris Wilson
2010-09-22 13:42                 ` Carlos R. Mafra
2010-09-22 14:29                   ` Chris Wilson
2010-09-22 15:26                     ` Carlos R. Mafra
2010-09-22 15:47                       ` Chris Wilson
2010-08-07 10:01 ` [PATCH 17/20] drm/i915/edp: Flush the write before waiting for PLLs Chris Wilson
2010-08-07 10:01 ` [PATCH 18/20] drm/i915: FBC is updated within set_base() so remove second call in mode_set() Chris Wilson
2010-08-07 10:01 ` [PATCH 19/20] drm/i915: Only update i845/i865 CURBASE when disabled (v2) Chris Wilson
2010-08-07 10:01 ` [PATCH 20/20] drm/i915: Apply i830 errata for cursor alignment Chris Wilson
2010-08-08 18:31   ` Eric Anholt

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=1281175299-1379-16-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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 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.