vulkan/wsi: clean up cleanup path
authorEric Engestrom <eric.engestrom@imgtec.com>
Mon, 26 Feb 2018 13:34:54 +0000 (13:34 +0000)
committerEric Engestrom <eric.engestrom@imgtec.com>
Fri, 9 Mar 2018 13:25:44 +0000 (13:25 +0000)
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/vulkan/wsi/wsi_common.c

index edba13a13de1a9493ecb56aa7fe302ab00307942..fe262b4968d3e45fa538b05d7183698a472140f1 100644 (file)
@@ -82,20 +82,20 @@ wsi_device_init(struct wsi_device *wsi,
 #ifdef VK_USE_PLATFORM_XCB_KHR
    result = wsi_x11_init_wsi(wsi, alloc);
    if (result != VK_SUCCESS)
-      return result;
+      goto fail;
 #endif
 
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
    result = wsi_wl_init_wsi(wsi, alloc, pdevice);
-   if (result != VK_SUCCESS) {
-#ifdef VK_USE_PLATFORM_XCB_KHR
-      wsi_x11_finish_wsi(wsi, alloc);
-#endif
-      return result;
-   }
+   if (result != VK_SUCCESS)
+      goto fail;
 #endif
 
    return VK_SUCCESS;
+
+fail:
+   wsi_device_finish(wsi, alloc);
+   return result;
 }
 
 void