Commit ee7fd957 authored by Michel Dänzer's avatar Michel Dänzer Committed by Alex Deucher

drm/amdgpu: Unpin BO if we can't get fences in amdgpu_crtc_page_flip

If reservation_object_get_fences_rcu failed, we'd previously go directly
to the cleanup label, so we'd leave the BO pinned.

While we're at it, remove two amdgpu_bo_unreserve calls in favour of two
new labels.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 313c45fd
...@@ -220,19 +220,17 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, ...@@ -220,19 +220,17 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
r = amdgpu_bo_pin_restricted(new_rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base); r = amdgpu_bo_pin_restricted(new_rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base);
if (unlikely(r != 0)) { if (unlikely(r != 0)) {
amdgpu_bo_unreserve(new_rbo);
r = -EINVAL; r = -EINVAL;
DRM_ERROR("failed to pin new rbo buffer before flip\n"); DRM_ERROR("failed to pin new rbo buffer before flip\n");
goto cleanup; goto unreserve;
} }
r = reservation_object_get_fences_rcu(new_rbo->tbo.resv, &work->excl, r = reservation_object_get_fences_rcu(new_rbo->tbo.resv, &work->excl,
&work->shared_count, &work->shared_count,
&work->shared); &work->shared);
if (unlikely(r != 0)) { if (unlikely(r != 0)) {
amdgpu_bo_unreserve(new_rbo);
DRM_ERROR("failed to get fences for buffer\n"); DRM_ERROR("failed to get fences for buffer\n");
goto cleanup; goto unpin;
} }
amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags); amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags);
...@@ -275,9 +273,11 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, ...@@ -275,9 +273,11 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
DRM_ERROR("failed to reserve new rbo in error path\n"); DRM_ERROR("failed to reserve new rbo in error path\n");
goto cleanup; goto cleanup;
} }
unpin:
if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) { if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) {
DRM_ERROR("failed to unpin new rbo in error path\n"); DRM_ERROR("failed to unpin new rbo in error path\n");
} }
unreserve:
amdgpu_bo_unreserve(new_rbo); amdgpu_bo_unreserve(new_rbo);
cleanup: cleanup:
......
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