anv/image: Return early when unbinding an image
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 22 Mar 2017 00:16:46 +0000 (17:16 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 22 Mar 2017 16:44:54 +0000 (09:44 -0700)
Found by inspection.

Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "17.0 13.0" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_image.c

index 7be988ab81470ac894ba74cd90b07d79ba32304f..33499abca1a54d6384b57f308481d7d98bdc9ed5 100644 (file)
@@ -335,14 +335,15 @@ VkResult anv_BindImageMemory(
    ANV_FROM_HANDLE(anv_device_memory, mem, _memory);
    ANV_FROM_HANDLE(anv_image, image, _image);
 
-   if (mem) {
-      image->bo = &mem->bo;
-      image->offset = memoryOffset;
-   } else {
+   if (mem == NULL) {
       image->bo = NULL;
       image->offset = 0;
+      return VK_SUCCESS;
    }
 
+   image->bo = &mem->bo;
+   image->offset = memoryOffset;
+
    if (image->aux_surface.isl.size > 0) {
 
       /* The offset and size must be a multiple of 4K or else the