From 794a9cf3d6e7b2ccc7afc35009918fa87ff1026e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 6 Nov 2021 15:56:21 -0700 Subject: [PATCH] vulkan/wsi: Unlock before return on error path. Fix defect reported by Coverity Scan. Missing unlock (LOCK) missing_unlock: Returning without unlocking wsi->wait_mutex. Fixes: 4885e63a6d2 ("vulkan/wsi: implement missing wsi_register_device_event") Signed-off-by: Vinson Lee Reviewed-by: Jason Ekstrand Part-of: --- src/vulkan/wsi/wsi_common_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index dae6adc5b72..50a821c3f33 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -2683,8 +2683,10 @@ wsi_register_device_event(VkDevice device, mtx_lock(&wsi->wait_mutex); if (!wsi->hotplug_thread) { if (pthread_create(&wsi->hotplug_thread, NULL, udev_event_listener_thread, - wsi_device)) + wsi_device)) { + mtx_unlock(&wsi->wait_mutex); return VK_ERROR_OUT_OF_HOST_MEMORY; + } } mtx_unlock(&wsi->wait_mutex); #endif