drm/i915: Don't leak framebuffer_references if drm_framebuffer_init() fails
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 14 Jan 2016 13:22:09 +0000 (15:22 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 15 Jan 2016 19:04:07 +0000 (21:04 +0200)
Don't increment obj->framebuffer_references until we know we actually
managed to create the framebuffer.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1452777736-4909-2-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_display.c

index 68a98570f658282267ba854d82a72868e6343c7e..c532c3d605ac7d934ffa7fc69dc9c699652c4cdb 100644 (file)
@@ -14905,7 +14905,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) {
@@ -14913,6 +14912,8 @@ static int intel_framebuffer_init(struct drm_device *dev,
                return ret;
        }
 
+       intel_fb->obj->framebuffer_references++;
+
        return 0;
 }