diff options
| author | Christian König <[email protected]> | 2020-06-16 12:33:23 +0000 |
|---|---|---|
| committer | Christian König <[email protected]> | 2020-06-29 15:54:12 +0000 |
| commit | 58e4d686d456c3e356439ae160ff4a0728940b8e (patch) | |
| tree | a3faa1faa59b975b50e268a5049c50737acd385a /drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | |
| parent | Backmerge remote-tracking branch 'drm/drm-next' into drm-misc-next (diff) | |
| download | kernel-58e4d686d456c3e356439ae160ff4a0728940b8e.tar.gz kernel-58e4d686d456c3e356439ae160ff4a0728940b8e.zip | |
drm/ttm: cleanup ttm_mem_type_manager_func.get_node interface v3
Instead of signaling failure by setting the node pointer to
NULL do so by returning -ENOSPC.
v2: add memset() to make sure that mem is always initialized.
v3: drop memset() only set mm_node = NULL, move mm_node init in amdgpu
Signed-off-by: Christian König <[email protected]>
Reviewed-by: Michael J. Ruhl <[email protected]>
Link: https://patchwork.freedesktop.org/patch/373181/
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c index d399e5893170..ad5732f8d4d2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c @@ -319,8 +319,7 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man, mem_bytes = (u64)mem->num_pages << PAGE_SHIFT; if (atomic64_add_return(mem_bytes, &mgr->usage) > max_bytes) { atomic64_sub(mem_bytes, &mgr->usage); - mem->mm_node = NULL; - return 0; + return -ENOSPC; } if (place->flags & TTM_PL_FLAG_CONTIGUOUS) { @@ -400,7 +399,7 @@ error: atomic64_sub(mem->num_pages << PAGE_SHIFT, &mgr->usage); kvfree(nodes); - return r == -ENOSPC ? 0 : r; + return r; } /** |
