[Mesa-dev] [PATCH 3/5] anv/image: Fix return type of make_surface()

Chad Versace chadversary at chromium.org
Mon Mar 6 18:18:42 UTC 2017


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 ab92df5d754..8f4fbd56a16 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -137,7 +137,7 @@ add_surface(struct anv_image *image, struct anv_surface *surf)
  *
  * 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,
@@ -245,8 +245,6 @@ make_surface(const struct anv_device *dev,
          image->aux_usage = ISL_AUX_USAGE_MCS;
       }
    }
-
-   return VK_SUCCESS;
 }
 
 VkResult
@@ -258,7 +256,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);
 
@@ -288,20 +285,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.12.0



More information about the mesa-dev mailing list