r = amdgpu_vm_clear_bo(adev, vm, pt);
if (r) {
+ amdgpu_bo_unref(&pt->shadow);
amdgpu_bo_unref(&pt);
goto error_free;
}
return 0;
error_free_page_directory:
+ amdgpu_bo_unref(&vm->page_directory->shadow);
amdgpu_bo_unref(&vm->page_directory);
vm->page_directory = NULL;
}
for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) {
- if (vm->page_tables[i].entry.robj &&
- vm->page_tables[i].entry.robj->shadow)
- amdgpu_bo_unref(&vm->page_tables[i].entry.robj->shadow);
- amdgpu_bo_unref(&vm->page_tables[i].entry.robj);
+ struct amdgpu_bo *pt = vm->page_tables[i].entry.robj;
+
+ if (!pt)
+ continue;
+
+ amdgpu_bo_unref(&pt->shadow);
+ amdgpu_bo_unref(&pt);
}
drm_free_large(vm->page_tables);
- if (vm->page_directory->shadow)
- amdgpu_bo_unref(&vm->page_directory->shadow);
+ amdgpu_bo_unref(&vm->page_directory->shadow);
amdgpu_bo_unref(&vm->page_directory);
fence_put(vm->page_directory_fence);
}