aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-12-21 08:33:34 -0500
committerTony Crisci <tony@dubstepdish.com>2017-12-21 08:33:34 -0500
commitb4159c52d5ee8bbcfdee291b19b503f9af7b24cd (patch)
tree750dcb459cbf6de877a3d373f7a05438f19df6d6 /backend
parentd1dce19253d0b4d30d99d2074a05fe7970391a61 (diff)
autocreate backend returns null instead of empty
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 2adc3171..359ee0e5 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -96,16 +96,14 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
struct wlr_session *session = wlr_session_create(display);
if (!session) {
wlr_log(L_ERROR, "Failed to start a DRM session");
- return backend;
+ goto out;
}
struct wlr_backend *libinput = wlr_libinput_backend_create(display, session);
- if (!libinput) {
- goto error_multi;
+ if (libinput) {
+ wlr_multi_backend_add(backend, libinput);
}
- wlr_multi_backend_add(backend, libinput);
-
int gpus[8];
size_t num_gpus = wlr_session_find_gpus(session, 8, gpus);
struct wlr_backend *primary_drm = NULL;
@@ -128,14 +126,14 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
if (!primary_drm) {
wlr_log(L_ERROR, "Failed to open any DRM device");
- goto error_multi;
}
- return backend;
+out:
+ if (wlr_multi_is_empty(backend)) {
+ wlr_backend_destroy(backend);
+ return NULL;
+ }
-error_multi:
- wlr_backend_destroy(backend);
- wlr_session_destroy(session);
return backend;
}