drm/qxl: properly handle device init failures

Specifically do not try release resources which where
not allocated in the first place.

Cc: Tong Zhang <ztong0001@gmail.com>
Tested-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20210217123213.2199186-2-kraxel@redhat.com
This commit is contained in:
Gerd Hoffmann 2021-02-17 13:32:03 +01:00
parent def26cd4ba
commit 26fe1f4c55
2 changed files with 7 additions and 0 deletions

View File

@ -1183,6 +1183,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
{
int ret;
if (!qdev->monitors_config_bo)
return 0;
qdev->monitors_config = NULL;
qdev->ram_header->monitors_config = 0;

View File

@ -288,6 +288,10 @@ void qxl_device_fini(struct qxl_device *qdev)
{
int cur_idx;
/* check if qxl_device_init() was successful (gc_work is initialized last) */
if (!qdev->gc_work.func)
return;
for (cur_idx = 0; cur_idx < 3; cur_idx++) {
if (!qdev->current_release_bo[cur_idx])
continue;