Commit bc6bc15b authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: fix up error cleanup in i915_gem_object_bind_to_gtt

This has been broken in

commit 2f633156
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Wed Jul 17 12:19:03 2013 -0700

    drm/i915: Create VMAs

which resulted in an OOPS the first time around we've hit -ENOSPC.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67156
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ben Widawsky <ben@bwidawsk.net>
Tested-by: default avatarmeng <mengmeng.meng@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarBen Widawsky <ben@bwidawsk.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 164c8598
......@@ -3137,8 +3137,8 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
vma = i915_gem_vma_create(obj, &dev_priv->gtt.base);
if (IS_ERR(vma)) {
i915_gem_object_unpin_pages(obj);
return PTR_ERR(vma);
ret = PTR_ERR(vma);
goto err_unpin;
}
search_free:
......@@ -3154,17 +3154,17 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
if (ret == 0)
goto search_free;
goto err_out;
goto err_free_vma;
}
if (WARN_ON(!i915_gem_valid_gtt_space(dev, &vma->node,
obj->cache_level))) {
ret = -EINVAL;
goto err_out;
goto err_remove_node;
}
ret = i915_gem_gtt_prepare_object(obj);
if (ret)
goto err_out;
goto err_remove_node;
list_move_tail(&obj->global_list, &dev_priv->mm.bound_list);
list_add_tail(&obj->mm_list, &vm->inactive_list);
......@@ -3183,9 +3183,11 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
i915_gem_verify_gtt(dev);
return 0;
err_out:
err_remove_node:
drm_mm_remove_node(&vma->node);
err_free_vma:
i915_gem_vma_destroy(vma);
err_unpin:
i915_gem_object_unpin_pages(obj);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment