Commit 7fb50b95 authored by Liviu Dudau's avatar Liviu Dudau Committed by Daniel Vetter

drm/drm_vma_manager.c: Remove useless goto statement

Commit db2395eci ("drm: Convert drm_vma_manager to embedded
interval-tree in drm_mm") removed a line in drm_vma_offset_add() function that
makes checking the result of calling drm_mm_insert_node() and the goto
call redundant. Rework the function (as suggested by Chris Wilson) to
eliminate the need for the goto and associated label.

v2: rewrite function to remove all goto statements.

Fixes: db2395eci ("drm: Convert drm_vma_manager to embedded interval-tree in drm_mm")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171101144458.5353-1-Liviu.Dudau@arm.com
parent 304a4f6a
...@@ -203,21 +203,16 @@ EXPORT_SYMBOL(drm_vma_offset_lookup_locked); ...@@ -203,21 +203,16 @@ EXPORT_SYMBOL(drm_vma_offset_lookup_locked);
int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, int drm_vma_offset_add(struct drm_vma_offset_manager *mgr,
struct drm_vma_offset_node *node, unsigned long pages) struct drm_vma_offset_node *node, unsigned long pages)
{ {
int ret; int ret = 0;
write_lock(&mgr->vm_lock); write_lock(&mgr->vm_lock);
if (drm_mm_node_allocated(&node->vm_node)) { if (!drm_mm_node_allocated(&node->vm_node))
ret = 0; ret = drm_mm_insert_node(&mgr->vm_addr_space_mm,
goto out_unlock; &node->vm_node, pages);
}
ret = drm_mm_insert_node(&mgr->vm_addr_space_mm, &node->vm_node, pages);
if (ret)
goto out_unlock;
out_unlock:
write_unlock(&mgr->vm_lock); write_unlock(&mgr->vm_lock);
return ret; return ret;
} }
EXPORT_SYMBOL(drm_vma_offset_add); EXPORT_SYMBOL(drm_vma_offset_add);
......
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