ret = init_user_pages(*mem, user_addr);
if (ret)
goto allocate_init_user_pages_failed;
- }
-
- if (offset)
- *offset = amdgpu_bo_mmap_offset(bo);
-
- if (flags & (KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL |
- KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP)) {
+ } else if (flags & (KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL |
+ KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP)) {
ret = amdgpu_amdkfd_gpuvm_pin_bo(bo, AMDGPU_GEM_DOMAIN_GTT);
if (ret) {
pr_err("Pinning MMIO/DOORBELL BO during ALLOC FAILED\n");
bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT;
}
+ if (offset)
+ *offset = amdgpu_bo_mmap_offset(bo);
+
return 0;
allocate_init_user_pages_failed:
- remove_kgd_mem_from_kfd_bo_list(*mem, avm->process_info);
err_pin_bo:
+ remove_kgd_mem_from_kfd_bo_list(*mem, avm->process_info);
drm_vma_node_revoke(&gobj->vma_node, drm_priv);
err_node_allow:
/* Don't unreserve system mem limit twice */