drm/amdgpu: validate duplicates first
authorChristian König <christian.koenig@amd.com>
Mon, 11 Jan 2016 14:35:22 +0000 (15:35 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 13 Jan 2016 17:22:59 +0000 (12:22 -0500)
Most VM BOs end up in the duplicates list, validate it
first make -ENOMEM less likely.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <David1.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

index 1fffc338f69dbf52a45e2156c8a06014ee5c2246..6f89f8e034d0eb05b96378581f8dfa7dee0fb319 100644 (file)
@@ -421,11 +421,11 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p)
 
        amdgpu_vm_get_pt_bos(&fpriv->vm, &duplicates);
 
-       r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &p->validated);
+       r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &duplicates);
        if (r)
                goto error_validate;
 
-       r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &duplicates);
+       r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &p->validated);
 
 error_validate:
        if (r) {