vulkan: initialize a variable
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 17 Aug 2022 22:09:22 +0000 (18:09 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 00:13:27 +0000 (00:13 +0000)
../src/vulkan/runtime/vk_fence.c: In function ‘vk_common_CreateFence’:
../src/vulkan/runtime/vk_fence.c:160:12: warning: ‘fence’ may be used uninitialized [-Wmaybe-uninitialized]
  160 |    *pFence = vk_fence_to_handle(fence);
      |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/vulkan/runtime/vk_fence.c:154:21: note: ‘fence’ was declared here
  154 |    struct vk_fence *fence;

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18119>

src/vulkan/runtime/vk_fence.c

index bcb2b11..bf2bb76 100644 (file)
@@ -151,7 +151,7 @@ vk_common_CreateFence(VkDevice _device,
                       VkFence *pFence)
 {
    VK_FROM_HANDLE(vk_device, device, _device);
-   struct vk_fence *fence;
+   struct vk_fence *fence = NULL;
 
    VkResult result = vk_fence_create(device, pCreateInfo, pAllocator, &fence);
    if (result != VK_SUCCESS)