[Mesa-dev] [PATCH mesa] vulkan/wsi: clean up cleanup path

Eric Engestrom eric.engestrom at imgtec.com
Mon Feb 26 13:51:13 UTC 2018


Cc: Keith Packard <keithp at keithp.com>
Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
This will make Keith's addition much cleaner as well :)
---
 src/vulkan/wsi/wsi_common.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index edba13a13de1a9493ecb..fe262b4968d3e45fa538 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -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
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list