diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-27 08:18:22 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-05-28 14:01:02 -0400 |
commit | 68f95ba9e260516411411524c45263b5d53f393c (patch) | |
tree | b850c0eb9971f1b7e9daf0e467db832cb02a2be2 | |
parent | 654fc6073f68efa3b6c466825749e73e7fbb92cd (diff) |
drm/i915: Cleanup after failed initialization of ringbuffers
The callers expect us to cleanup any partially initialised structures
before reporting the error.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index f84c8e982dcb..42866c01540d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -4632,23 +4632,40 @@ i915_gem_init_ringbuffer(struct drm_device *dev) | |||
4632 | { | 4632 | { |
4633 | drm_i915_private_t *dev_priv = dev->dev_private; | 4633 | drm_i915_private_t *dev_priv = dev->dev_private; |
4634 | int ret; | 4634 | int ret; |
4635 | |||
4635 | dev_priv->render_ring = render_ring; | 4636 | dev_priv->render_ring = render_ring; |
4637 | |||
4636 | if (!I915_NEED_GFX_HWS(dev)) { | 4638 | if (!I915_NEED_GFX_HWS(dev)) { |
4637 | dev_priv->render_ring.status_page.page_addr | 4639 | dev_priv->render_ring.status_page.page_addr |
4638 | = dev_priv->status_page_dmah->vaddr; | 4640 | = dev_priv->status_page_dmah->vaddr; |
4639 | memset(dev_priv->render_ring.status_page.page_addr, | 4641 | memset(dev_priv->render_ring.status_page.page_addr, |
4640 | 0, PAGE_SIZE); | 4642 | 0, PAGE_SIZE); |
4641 | } | 4643 | } |
4644 | |||
4642 | if (HAS_PIPE_CONTROL(dev)) { | 4645 | if (HAS_PIPE_CONTROL(dev)) { |
4643 | ret = i915_gem_init_pipe_control(dev); | 4646 | ret = i915_gem_init_pipe_control(dev); |
4644 | if (ret) | 4647 | if (ret) |
4645 | return ret; | 4648 | return ret; |
4646 | } | 4649 | } |
4650 | |||
4647 | ret = intel_init_ring_buffer(dev, &dev_priv->render_ring); | 4651 | ret = intel_init_ring_buffer(dev, &dev_priv->render_ring); |
4648 | if (!ret && HAS_BSD(dev)) { | 4652 | if (ret) |
4653 | goto cleanup_pipe_control; | ||
4654 | |||
4655 | if (HAS_BSD(dev)) { | ||
4649 | dev_priv->bsd_ring = bsd_ring; | 4656 | dev_priv->bsd_ring = bsd_ring; |
4650 | ret = intel_init_ring_buffer(dev, &dev_priv->bsd_ring); | 4657 | ret = intel_init_ring_buffer(dev, &dev_priv->bsd_ring); |
4658 | if (ret) | ||
4659 | goto cleanup_render_ring; | ||
4651 | } | 4660 | } |
4661 | |||
4662 | return 0; | ||
4663 | |||
4664 | cleanup_render_ring: | ||
4665 | intel_cleanup_ring_buffer(dev, &dev_priv->render_ring); | ||
4666 | cleanup_pipe_control: | ||
4667 | if (HAS_PIPE_CONTROL(dev)) | ||
4668 | i915_gem_cleanup_pipe_control(dev); | ||
4652 | return ret; | 4669 | return ret; |
4653 | } | 4670 | } |
4654 | 4671 | ||