[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1432721046-4418-8-git-send-email-fziglio@redhat.com>
Date: Wed, 27 May 2015 11:04:02 +0100
From: Frediano Ziglio <fziglio@...hat.com>
To: fziglio@...hat.com, spice-devel@...ts.freedesktop.org,
airlied@...ux.ie, dri-devel@...ts.freedesktop.org,
airlied@...hat.com
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 07/11] Handle correctly failures in qxl_alloc_relase_reserved
Free resources correctly if function fails
Signed-off-by: Frediano Ziglio <fziglio@...hat.com>
---
qxl/qxl_release.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/qxl/qxl_release.c b/qxl/qxl_release.c
index 6fd8e50..00604ed 100644
--- a/qxl/qxl_release.c
+++ b/qxl/qxl_release.c
@@ -363,6 +363,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
ret = qxl_release_bo_alloc(qdev, &qdev->current_release_bo[cur_idx]);
if (ret) {
mutex_unlock(&qdev->release_mutex);
+ qxl_release_free(qdev, *release);
return ret;
}
}
@@ -377,13 +378,17 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
mutex_unlock(&qdev->release_mutex);
- qxl_release_list_add(*release, bo);
+ ret = qxl_release_list_add(*release, bo);
+ qxl_bo_unref(&bo);
+ if (ret) {
+ qxl_release_free(qdev, *release);
+ return ret;
+ }
info = qxl_release_map(qdev, *release);
info->id = idr_ret;
qxl_release_unmap(qdev, *release, info);
- qxl_bo_unref(&bo);
return ret;
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists