diff mbox

[05/34] drm/i915: Call context fini at cleanup

Message ID 1369510028-3343-6-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky May 25, 2013, 7:26 p.m. UTC
If contexts were actually initialized, and we fail somewhere later during
init this would possibly leak memory, and lead to some error messages
about unclean takedown. As the odds of this occurring, and someone
actually caring/noticing are pretty slim, the patch isn't terribly
important.

Found by code inspection while working on something else.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_dma.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniel Vetter May 26, 2013, 1:27 p.m. UTC | #1
On Sat, May 25, 2013 at 12:26:39PM -0700, Ben Widawsky wrote:
> If contexts were actually initialized, and we fail somewhere later during
> init this would possibly leak memory, and lead to some error messages
> about unclean takedown. As the odds of this occurring, and someone
> actually caring/noticing are pretty slim, the patch isn't terribly
> important.
> 
> Found by code inspection while working on something else.
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>

Applied patches 1-5 to dinq, with a tiny bikeshed on patch 5. Wrt all
these cleanup paths I think we should seriously look at more structured
options like devres.c ...
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_dma.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index fe969cf..3ae8298 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1359,6 +1359,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  cleanup_gem:
>  	mutex_lock(&dev->struct_mutex);
>  	i915_gem_cleanup_ringbuffer(dev);
> +	i915_gem_context_fini(dev);
>  	mutex_unlock(&dev->struct_mutex);
>  	i915_gem_cleanup_aliasing_ppgtt(dev);
>  	drm_mm_takedown(&dev_priv->mm.gtt_space);
> -- 
> 1.8.2.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index fe969cf..3ae8298 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1359,6 +1359,7 @@  static int i915_load_modeset_init(struct drm_device *dev)
 cleanup_gem:
 	mutex_lock(&dev->struct_mutex);
 	i915_gem_cleanup_ringbuffer(dev);
+	i915_gem_context_fini(dev);
 	mutex_unlock(&dev->struct_mutex);
 	i915_gem_cleanup_aliasing_ppgtt(dev);
 	drm_mm_takedown(&dev_priv->mm.gtt_space);