[PATCH] [PATCH i-g-t v2] tests/amdgpu/amd_vm: fix vm test issue

Jesse Zhang jesse.zhang at amd.com
Mon Jan 8 01:21:57 UTC 2024


Initialize the variable "r" before using it,
in the subtest amdgpu-vm-unaligned-map.
V2:
  --fix code style and description (Kamil and Christian).

Cc: Vitaly Prosyak <vitaly.prosyak at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Christian Koenig <christian.koenig at amd.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
Acked-by: Christian König <christian.koenig at amd.com>
---
 tests/amdgpu/amd_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/amdgpu/amd_vm.c b/tests/amdgpu/amd_vm.c
index dab91f291..9cd56e2b5 100644
--- a/tests/amdgpu/amd_vm.c
+++ b/tests/amdgpu/amd_vm.c
@@ -127,7 +127,8 @@ amdgpu_vm_unaligned_map(amdgpu_device_handle device_handle)
 	request.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
 	request.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
 
-	if (-ENOMEM == amdgpu_bo_alloc(device_handle, &request, &buf_handle)) {
+	r = amdgpu_bo_alloc(device_handle, &request, &buf_handle);
+	if (r == -ENOMEM) {
 		/* Try allocate on the device of small memory */
 		request.alloc_size = 8ULL << 20;
 		map_size = (8ULL << 20) - (2 << 12);
-- 
2.25.1



More information about the igt-dev mailing list