Commit 26fe1f4c authored by Gerd Hoffmann's avatar Gerd Hoffmann

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: default avatarTong Zhang <ztong0001@gmail.com>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20210217123213.2199186-2-kraxel@redhat.com
parent def26cd4
...@@ -1183,6 +1183,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) ...@@ -1183,6 +1183,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
{ {
int ret; int ret;
if (!qdev->monitors_config_bo)
return 0;
qdev->monitors_config = NULL; qdev->monitors_config = NULL;
qdev->ram_header->monitors_config = 0; qdev->ram_header->monitors_config = 0;
......
...@@ -288,6 +288,10 @@ void qxl_device_fini(struct qxl_device *qdev) ...@@ -288,6 +288,10 @@ void qxl_device_fini(struct qxl_device *qdev)
{ {
int cur_idx; 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++) { for (cur_idx = 0; cur_idx < 3; cur_idx++) {
if (!qdev->current_release_bo[cur_idx]) if (!qdev->current_release_bo[cur_idx])
continue; continue;
......
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