summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2015-06-03 12:09:15 +0100
committerDave Airlie <airlied@redhat.com>2015-06-05 11:00:50 +1000
commitde0b523a5a4c99859513238559d62e0dd4a9a67e (patch)
treeecfff5ef1abb038e89a938d83e595afc575b0cce /drivers
parent6ecf5c2b571e47b87568446f86b00838fcd0294d (diff)
downloadkernel-de0b523a5a4c99859513238559d62e0dd4a9a67e.tar.gz
drm/qxl: Handle correctly failures in qxl_alloc_relase_reserved
Free resources correctly if function fails Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/qxl/qxl_release.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index 6fd8e50e3506..00604ed173a2 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/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;
}