drm/tegra: fb: Properly release GEM objects on failure
authorThierry Reding <treding@nvidia.com>
Thu, 6 Nov 2014 13:33:19 +0000 (14:33 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 13 Nov 2014 15:18:33 +0000 (16:18 +0100)
When fbdev initialization fails, make sure to unreference the GEM
objects properly. Note that we can't do this in the general error
unwinding path because ownership of the GEM object references is
transferred to the framebuffer upon creation.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/fb.c

index ec5ae7cf43493e5b256e042fb54bfe5bdf5aec65..a64f23af0841d3f402212418d7a3a19df54f5ead 100644 (file)
@@ -227,7 +227,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
        info = framebuffer_alloc(0, drm->dev);
        if (!info) {
                dev_err(drm->dev, "failed to allocate framebuffer info\n");
-               tegra_bo_free_object(&bo->gem);
+               drm_gem_object_unreference_unlocked(&bo->gem);
                return -ENOMEM;
        }
 
@@ -235,6 +235,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
        if (IS_ERR(fbdev->fb)) {
                dev_err(drm->dev, "failed to allocate DRM framebuffer\n");
                err = PTR_ERR(fbdev->fb);
+               drm_gem_object_unreference_unlocked(&bo->gem);
                goto release;
        }