summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_bo_vm.c
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2018-01-26 17:22:05 +0300
committerAlex Deucher <alexander.deucher@amd.com>2018-02-19 22:18:59 +0300
commitde8dfb8e3449c704e2c67680b9226a058e6dc663 (patch)
tree7a3f0f790723bf45da0257d9f85ec05e0b667624 /drivers/gpu/drm/ttm/ttm_bo_vm.c
parent449f797a94f206e15a088adabb26c7cc42aa79b4 (diff)
downloadlinux-de8dfb8e3449c704e2c67680b9226a058e6dc663.tar.xz
drm/ttm: Remove unncessary retval from ttm_bo_vm_fault()
The dual ret/retval was more complex than need be. Now we drop the retval variable and assign the appropriate VM codes to ret instead. Signed-off-by: Tom St Denis <tom.stdenis@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo_vm.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_vm.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 60fcef1593dd..716e724ac710 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -118,7 +118,6 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
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;
@@ -158,7 +157,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
* (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;
}
@@ -169,10 +168,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
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;
}
}
@@ -183,12 +182,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
*/
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;
@@ -196,12 +193,12 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
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;
}
@@ -211,7 +208,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
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;
}
@@ -238,7 +235,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
/* 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;
}
}
@@ -255,7 +252,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
} 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;
@@ -280,7 +277,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
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;
}
@@ -289,11 +286,12 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
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)