[Intel-gfx] [PATCH 19/22] drm/i915: Don't leak framebuffer_references if drm_framebuffer_init() fails

Daniel Vetter daniel at ffwll.ch
Wed Oct 21 04:42:35 PDT 2015


On Wed, Oct 14, 2015 at 07:29:11PM +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Don't increment obj->framebuffer_references until we know we actually
> managed to create the framebuffer.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 70e6e27..0cfedf9 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14453,7 +14453,6 @@ static int intel_framebuffer_init(struct drm_device *dev,
>  
>  	drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
>  	intel_fb->obj = obj;
> -	intel_fb->obj->framebuffer_references++;
>  
>  	ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
>  	if (ret) {
> @@ -14461,6 +14460,8 @@ static int intel_framebuffer_init(struct drm_device *dev,
>  		return ret;
>  	}
>  
> +	intel_fb->obj->framebuffer_references++;
> +
>  	return 0;
>  }
>  
> -- 
> 2.4.9
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list