Skip to content

Commit 7fb50b9

Browse files
dliviudanvet
authored andcommitted
drm/drm_vma_manager.c: Remove useless goto statement
Commit db2395eccf08i ("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: db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree in drm_mm") Cc: Chris Wilson <[email protected]> Signed-off-by: Liviu Dudau <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 304a4f6 commit 7fb50b9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/gpu/drm/drm_vma_manager.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,16 @@ EXPORT_SYMBOL(drm_vma_offset_lookup_locked);
203203
int drm_vma_offset_add(struct drm_vma_offset_manager *mgr,
204204
struct drm_vma_offset_node *node, unsigned long pages)
205205
{
206-
int ret;
206+
int ret = 0;
207207

208208
write_lock(&mgr->vm_lock);
209209

210-
if (drm_mm_node_allocated(&node->vm_node)) {
211-
ret = 0;
212-
goto out_unlock;
213-
}
210+
if (!drm_mm_node_allocated(&node->vm_node))
211+
ret = drm_mm_insert_node(&mgr->vm_addr_space_mm,
212+
&node->vm_node, pages);
214213

215-
ret = drm_mm_insert_node(&mgr->vm_addr_space_mm, &node->vm_node, pages);
216-
if (ret)
217-
goto out_unlock;
218-
219-
out_unlock:
220214
write_unlock(&mgr->vm_lock);
215+
221216
return ret;
222217
}
223218
EXPORT_SYMBOL(drm_vma_offset_add);

0 commit comments

Comments
 (0)