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

Christian König christian.koenig at amd.com
Fri Jan 5 09:43:33 UTC 2024


Am 05.01.24 um 06:18 schrieb Jesse Zhang:
> Initialize the variable "r" before using it.
>
> 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>
> ---
>   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..bb7b6f173 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 (-ENOMEM == r) {

For the kernel it's usually preferred to write "r == -ENOMEM", but could 
be that it's just the other way around here.  Not sure what coding style 
the IGT tests prefer.

Either way Acked-by: Christian König <christian.koenig at amd.com>.

Regards,
Christian.

>   		/* Try allocate on the device of small memory */
>   		request.alloc_size = 8ULL << 20;
>   		map_size = (8ULL << 20) - (2 << 12);



More information about the igt-dev mailing list