[Mesa-dev] [RFC v2 09/22] anv/image: Fix return type of make_surface()

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Thu Aug 31 04:24:10 UTC 2017


From: Chad Versace <chadversary at chromium.org>

make_surface() always returns VK_SUCCESS, so change its return type to
'void'. This simplifies the return-code handling in
anv_image_create_info() and removes a goto.
---
 src/intel/vulkan/anv_image.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 313809803a..3d1b3f1e73 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -215,7 +215,7 @@ add_fast_clear_state_buffer(struct anv_image *image,
  *
  * Exactly one bit must be set in \a aspect.
  */
-static VkResult
+static void
 make_surface(const struct anv_device *dev,
              struct anv_image *image,
              const struct anv_image_create_info *anv_info,
@@ -340,8 +340,6 @@ make_surface(const struct anv_device *dev,
          image->aux_usage = ISL_AUX_USAGE_MCS;
       }
    }
-
-   return VK_SUCCESS;
 }
 
 VkResult
@@ -353,7 +351,6 @@ anv_image_create(VkDevice _device,
    ANV_FROM_HANDLE(anv_device, device, _device);
    const VkImageCreateInfo *base_info = anv_info->vk_info;
    struct anv_image *image = NULL;
-   VkResult r;
 
    assert(base_info->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
 
@@ -382,20 +379,12 @@ anv_image_create(VkDevice _device,
 
    uint32_t b;
    for_each_bit(b, image->aspects) {
-      r = make_surface(device, image, anv_info, (1 << b));
-      if (r != VK_SUCCESS)
-         goto fail;
+      make_surface(device, image, anv_info, (1 << b));
    }
 
    *pImage = anv_image_to_handle(image);
 
    return VK_SUCCESS;
-
-fail:
-   if (image)
-      vk_free2(&device->alloc, alloc, image);
-
-   return r;
 }
 
 VkResult
-- 
2.13.0



More information about the mesa-dev mailing list