int ret;
int i;
unsigned long address = vmf->address;
- int retval = VM_FAULT_NOPAGE;
struct ttm_mem_type_manager *man =
&bdev->man[bo->mem.mem_type];
struct vm_area_struct cvma;
* (if at all) by redirecting mmap to the exporter.
*/
if (bo->ttm && (bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) {
- retval = VM_FAULT_SIGBUS;
+ ret = VM_FAULT_SIGBUS;
goto out_unlock;
}
break;
case -EBUSY:
case -ERESTARTSYS:
- retval = VM_FAULT_NOPAGE;
+ ret = VM_FAULT_NOPAGE;
goto out_unlock;
default:
- retval = VM_FAULT_SIGBUS;
+ ret = VM_FAULT_SIGBUS;
goto out_unlock;
}
}
*/
ret = ttm_bo_vm_fault_idle(bo, vmf);
if (unlikely(ret != 0)) {
- retval = ret;
-
- if (retval == VM_FAULT_RETRY &&
+ if (ret == VM_FAULT_RETRY &&
!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
/* The BO has already been unreserved. */
- return retval;
+ return ret;
}
goto out_unlock;
ret = ttm_mem_io_lock(man, true);
if (unlikely(ret != 0)) {
- retval = VM_FAULT_NOPAGE;
+ ret = VM_FAULT_NOPAGE;
goto out_unlock;
}
ret = ttm_mem_io_reserve_vm(bo);
if (unlikely(ret != 0)) {
- retval = VM_FAULT_SIGBUS;
+ ret = VM_FAULT_SIGBUS;
goto out_io_unlock;
}
drm_vma_node_start(&bo->vma_node);
if (unlikely(page_offset >= bo->num_pages)) {
- retval = VM_FAULT_SIGBUS;
+ ret = VM_FAULT_SIGBUS;
goto out_io_unlock;
}
/* Allocate all page at once, most common usage */
if (ttm->bdev->driver->ttm_tt_populate(ttm, &ctx)) {
- retval = VM_FAULT_OOM;
+ ret = VM_FAULT_OOM;
goto out_io_unlock;
}
}
} else {
page = ttm->pages[page_offset];
if (unlikely(!page && i == 0)) {
- retval = VM_FAULT_OOM;
+ ret = VM_FAULT_OOM;
goto out_io_unlock;
} else if (unlikely(!page)) {
break;
if (unlikely((ret == -EBUSY) || (ret != 0 && i > 0)))
break;
else if (unlikely(ret != 0)) {
- retval =
+ ret =
(ret == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS;
goto out_io_unlock;
}
if (unlikely(++page_offset >= page_last))
break;
}
+ ret = VM_FAULT_NOPAGE;
out_io_unlock:
ttm_mem_io_unlock(man);
out_unlock:
ttm_bo_unreserve(bo);
- return retval;
+ return ret;
}
static void ttm_bo_vm_open(struct vm_area_struct *vma)