diff mbox

[05/11] Handle all errors in qxl_surface_evict

Message ID 1432721046-4418-6-git-send-email-fziglio@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Frediano Ziglio May 27, 2015, 10:04 a.m. UTC
Only EBUSY error was handled. This could cause code to believe
reserve was successful while it failed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 qxl/qxl_cmd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Dave Airlie May 28, 2015, 3:16 a.m. UTC | #1
On 27 May 2015 at 20:04, Frediano Ziglio <fziglio@redhat.com> wrote:
> Only EBUSY error was handled. This could cause code to believe
> reserve was successful while it failed.
>
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>

This has been there since I wrote qxl, so I expect I had some reason
for it, but I can't remember it
now..

Most likely is something had the bo reserved already and we reentered
from somewhere we shouldn't
but I think a lot of the horrible code went away.

so because I can't justify the hack,
Reviewed-by: Dave Airlie <airlied@redhat.com>
Dave.
diff mbox

Patch

diff --git a/qxl/qxl_cmd.c b/qxl/qxl_cmd.c
index 85ed5dc..b18f84c 100644
--- a/qxl/qxl_cmd.c
+++ b/qxl/qxl_cmd.c
@@ -612,8 +612,8 @@  static int qxl_reap_surf(struct qxl_device *qdev, struct qxl_bo *surf, bool stal
 	int ret;
 
 	ret = qxl_bo_reserve(surf, false);
-	if (ret == -EBUSY)
-		return -EBUSY;
+	if (ret)
+		return ret;
 
 	if (stall)
 		mutex_unlock(&qdev->surf_evict_mutex);
@@ -622,9 +622,9 @@  static int qxl_reap_surf(struct qxl_device *qdev, struct qxl_bo *surf, bool stal
 
 	if (stall)
 		mutex_lock(&qdev->surf_evict_mutex);
-	if (ret == -EBUSY) {
+	if (ret) {
 		qxl_bo_unreserve(surf);
-		return -EBUSY;
+		return ret;
 	}
 
 	qxl_surface_evict_locked(qdev, surf, true);