radv: check for upload alloc failure
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 5 Mar 2017 21:04:52 +0000 (23:04 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 5 Mar 2017 23:10:42 +0000 (00:10 +0100)
Mainly to avoid gcc's complains about uninitialized ptr and offset use
later in that code.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index dec3e9fd21dfaf273cc7e6e38dce7a60e827dfe5..16c3f7893b927c521b72482f58a90e6df3be0227 100644 (file)
@@ -1285,9 +1285,10 @@ radv_flush_constants(struct radv_cmd_buffer *cmd_buffer,
        if (!stages || !layout || (!layout->push_constant_size && !layout->dynamic_offset_count))
                return;
 
-       radv_cmd_buffer_upload_alloc(cmd_buffer, layout->push_constant_size +
-                                    16 * layout->dynamic_offset_count,
-                                    256, &offset, &ptr);
+       if (!radv_cmd_buffer_upload_alloc(cmd_buffer, layout->push_constant_size +
+                                         16 * layout->dynamic_offset_count,
+                                         256, &offset, &ptr))
+               return;
 
        memcpy(ptr, cmd_buffer->push_constants, layout->push_constant_size);
        memcpy((char*)ptr + layout->push_constant_size, cmd_buffer->dynamic_buffers,