Skip to content

Commit e8188c4

Browse files
author
Thomas Hellström
committed
drm/ttm: Don't leak a resource on eviction error
On eviction errors other than -EMULTIHOP we were leaking a resource. Fix. v2: - Avoid yet another goto (Andi Shyti) Fixes: 4037979 ("drm/ttm: Fix multihop assert on eviction.") Cc: Andrey Grodzovsky <[email protected]> Cc: Christian König <[email protected]> Cc: Christian Koenig <[email protected]> Cc: Huang Rui <[email protected]> Cc: [email protected] Cc: <[email protected]> # v5.15+ Signed-off-by: Thomas Hellström <[email protected]> Reviewed-by: Nirmoy Das <[email protected]> #v1 Reviewed-by: Andi Shyti <[email protected]> Reviewed-by: Christian König <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 7aa83fb commit e8188c4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -458,18 +458,18 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo,
458458
goto out;
459459
}
460460

461-
bounce:
462-
ret = ttm_bo_handle_move_mem(bo, evict_mem, true, ctx, &hop);
463-
if (ret == -EMULTIHOP) {
461+
do {
462+
ret = ttm_bo_handle_move_mem(bo, evict_mem, true, ctx, &hop);
463+
if (ret != -EMULTIHOP)
464+
break;
465+
464466
ret = ttm_bo_bounce_temp_buffer(bo, &evict_mem, ctx, &hop);
465-
if (ret) {
466-
if (ret != -ERESTARTSYS && ret != -EINTR)
467-
pr_err("Buffer eviction failed\n");
468-
ttm_resource_free(bo, &evict_mem);
469-
goto out;
470-
}
471-
/* try and move to final place now. */
472-
goto bounce;
467+
} while (!ret);
468+
469+
if (ret) {
470+
ttm_resource_free(bo, &evict_mem);
471+
if (ret != -ERESTARTSYS && ret != -EINTR)
472+
pr_err("Buffer eviction failed\n");
473473
}
474474
out:
475475
return ret;

0 commit comments

Comments
 (0)