Commit 4953b6b2 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: cleanup error handling in amdgpu_cs_parser_bos

Return early on success and so remove all those "if (r)" in the error
path.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f4b92fcd
...@@ -933,25 +933,26 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, ...@@ -933,25 +933,26 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
if (r) if (r)
goto error_validate; goto error_validate;
amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved, if (p->uf_entry.tv.bo) {
p->bytes_moved_vis);
amdgpu_job_set_resources(p->job, p->bo_list->gds_obj,
p->bo_list->gws_obj, p->bo_list->oa_obj);
if (!r && p->uf_entry.tv.bo) {
struct amdgpu_bo *uf = ttm_to_amdgpu_bo(p->uf_entry.tv.bo); struct amdgpu_bo *uf = ttm_to_amdgpu_bo(p->uf_entry.tv.bo);
r = amdgpu_ttm_alloc_gart(&uf->tbo); r = amdgpu_ttm_alloc_gart(&uf->tbo);
if (r)
goto error_validate;
p->job->uf_addr += amdgpu_bo_gpu_offset(uf); p->job->uf_addr += amdgpu_bo_gpu_offset(uf);
} }
amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
p->bytes_moved_vis);
amdgpu_job_set_resources(p->job, p->bo_list->gds_obj,
p->bo_list->gws_obj, p->bo_list->oa_obj);
return 0;
error_validate: error_validate:
if (r)
ttm_eu_backoff_reservation(&p->ticket, &p->validated); ttm_eu_backoff_reservation(&p->ticket, &p->validated);
out_free_user_pages: out_free_user_pages:
if (r) {
amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) { amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
struct amdgpu_bo *bo = ttm_to_amdgpu_bo(e->tv.bo); struct amdgpu_bo *bo = ttm_to_amdgpu_bo(e->tv.bo);
...@@ -961,8 +962,6 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, ...@@ -961,8 +962,6 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
kvfree(e->user_pages); kvfree(e->user_pages);
e->user_pages = NULL; e->user_pages = NULL;
} }
mutex_unlock(&p->bo_list->bo_list_mutex);
}
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment