backend: close session file on drm backend creation failure

This commit is contained in:
Simon Zeni 2024-04-18 13:27:03 -04:00
parent 40fe1ce2c7
commit 9cf810c3fb

View file

@ -260,6 +260,8 @@ static struct wlr_backend *attempt_drm_backend(struct wlr_backend *backend, stru
for (size_t i = 0; i < (size_t)num_gpus; ++i) { for (size_t i = 0; i < (size_t)num_gpus; ++i) {
struct wlr_backend *drm = wlr_drm_backend_create(session, gpus[i], primary_drm); struct wlr_backend *drm = wlr_drm_backend_create(session, gpus[i], primary_drm);
if (!drm) { if (!drm) {
wlr_session_close_file(session, gpus[i]);
wlr_log(WLR_ERROR, "Failed to create DRM backend"); wlr_log(WLR_ERROR, "Failed to create DRM backend");
continue; continue;
} }
@ -270,6 +272,7 @@ static struct wlr_backend *attempt_drm_backend(struct wlr_backend *backend, stru
wlr_multi_backend_add(backend, drm); wlr_multi_backend_add(backend, drm);
} }
if (!primary_drm) { if (!primary_drm) {
wlr_log(WLR_ERROR, "Could not successfully create backend on any GPU"); wlr_log(WLR_ERROR, "Could not successfully create backend on any GPU");
return NULL; return NULL;