diff options
author | Christian König <christian.koenig@amd.com> | 2018-07-27 09:32:04 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-07-31 17:58:16 -0400 |
commit | 52c054caf83012fe9fe858ee86d90b4ea2cc3cca (patch) | |
tree | 614a12fd37355647ceef8c1bcc3455c695a2641f /drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |
parent | ccf9ef0b0d10434dec5046bcfc4e834a7b1830fd (diff) |
drm/amdgpu: add proper error handling to amdgpu_bo_list_get
Otherwise we silently don't use a BO list when the handle is invalid.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 533b2e7656c0..8a49c3b97bd4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -572,11 +572,16 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, | |||
572 | INIT_LIST_HEAD(&p->validated); | 572 | INIT_LIST_HEAD(&p->validated); |
573 | 573 | ||
574 | /* p->bo_list could already be assigned if AMDGPU_CHUNK_ID_BO_HANDLES is present */ | 574 | /* p->bo_list could already be assigned if AMDGPU_CHUNK_ID_BO_HANDLES is present */ |
575 | if (!p->bo_list) | 575 | if (p->bo_list) { |
576 | p->bo_list = amdgpu_bo_list_get(fpriv, cs->in.bo_list_handle); | ||
577 | else | ||
578 | mutex_lock(&p->bo_list->lock); | 576 | mutex_lock(&p->bo_list->lock); |
579 | 577 | ||
578 | } else if (cs->in.bo_list_handle) { | ||
579 | r = amdgpu_bo_list_get(fpriv, cs->in.bo_list_handle, | ||
580 | &p->bo_list); | ||
581 | if (r) | ||
582 | return r; | ||
583 | } | ||
584 | |||
580 | if (p->bo_list) { | 585 | if (p->bo_list) { |
581 | amdgpu_bo_list_get_list(p->bo_list, &p->validated); | 586 | amdgpu_bo_list_get_list(p->bo_list, &p->validated); |
582 | if (p->bo_list->first_userptr != p->bo_list->num_entries) | 587 | if (p->bo_list->first_userptr != p->bo_list->num_entries) |