[Mesa-dev] [PATCH 3/4] vulkan/wsi: initialise image_index to 0 in x11_manage_fifo_queues

Kai Wasserbäch kai at dev.carbon-project.org
Fri Aug 17 14:32:33 UTC 2018


Supresses a maybe-uninitialized warning with GCC 8.

Note: image_index should always be initialised due to the result check,
      but the compiler doesn't see that.
Signed-off-by: Kai Wasserbäch <kai at dev.carbon-project.org>
---
 src/vulkan/wsi/wsi_common_x11.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 7e7b3a94e4..7b930884b4 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -991,7 +991,7 @@ x11_manage_fifo_queues(void *state)
        * before that point so the client should be able to acquire any image
        * other than the currently presented one.
        */
-      uint32_t image_index;
+      uint32_t image_index = 0;
       result = wsi_queue_pull(&chain->present_queue, &image_index, INT64_MAX);
       assert(result != VK_TIMEOUT);
       if (result < 0) {
-- 
2.18.0



More information about the mesa-dev mailing list