diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ef92c69..e0bff07 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2616,6 +2616,9 @@ int i915_vma_unbind(struct i915_vma *vma) drm_i915_private_t *dev_priv = obj->base.dev->dev_private; int ret; + /* For now we only ever use 1 vma per object */ + WARN_ON(!list_is_singular(&obj->vma_list)); + if (list_empty(&vma->vma_link)) return 0; @@ -2661,7 +2664,9 @@ int i915_vma_unbind(struct i915_vma *vma) drm_mm_remove_node(&vma->node); destroy: - i915_gem_vma_destroy(vma); + /* Keep the vma as a placeholder in the execbuffer reservation lists */ + if (!list_empty(&vma->exec_list)) + i915_gem_vma_destroy(vma); /* Since the unbound list is global, only move to that list if * no more VMAs exist. @@ -4171,10 +4176,6 @@ void i915_gem_vma_destroy(struct i915_vma *vma) WARN_ON(vma->node.allocated); list_del(&vma->vma_link); - /* Keep the vma as a placeholder in the execbuffer reservation lists */ - if (!list_empty(&vma->exec_list)) - return; - kfree(vma); }