radv: fix wmaybe-uninitialized in radv_meta_fast_clear.c

Submitted by Andres Rodriguez on July 18, 2018, 6:24 p.m.

Details

Message ID 20180718182449.21231-1-andresx7@gmail.com
State New
Headers show
Series "radv: fix wmaybe-uninitialized in radv_meta_fast_clear.c" ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Andres Rodriguez July 18, 2018, 6:24 p.m.
Assignment and usage of this variable both happen inside an
if(rad_image_has_dcc()) {} blocks. It seems gcc plays it safe and
assumes that both function calls could have different return values.

But in this case we should be safe.
---
 src/amd/vulkan/radv_meta_fast_clear.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c
index 932a6c93aa2..b42a6783fd2 100644
--- a/src/amd/vulkan/radv_meta_fast_clear.c
+++ b/src/amd/vulkan/radv_meta_fast_clear.c
@@ -586,7 +586,7 @@  radv_emit_color_decompress(struct radv_cmd_buffer *cmd_buffer,
 	VkDevice device_h = radv_device_to_handle(cmd_buffer->device);
 	VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer);
 	uint32_t layer_count = radv_get_layerCount(image, subresourceRange);
-	bool old_predicating;
+	bool old_predicating = false;
 	VkPipeline pipeline;
 
 	assert(cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL);

Comments

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>

On 07/18/2018 08:24 PM, Andres Rodriguez wrote:
> Assignment and usage of this variable both happen inside an
> if(rad_image_has_dcc()) {} blocks. It seems gcc plays it safe and
> assumes that both function calls could have different return values.
> 
> But in this case we should be safe.
> ---
>   src/amd/vulkan/radv_meta_fast_clear.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c
> index 932a6c93aa2..b42a6783fd2 100644
> --- a/src/amd/vulkan/radv_meta_fast_clear.c
> +++ b/src/amd/vulkan/radv_meta_fast_clear.c
> @@ -586,7 +586,7 @@ radv_emit_color_decompress(struct radv_cmd_buffer *cmd_buffer,
>   	VkDevice device_h = radv_device_to_handle(cmd_buffer->device);
>   	VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer);
>   	uint32_t layer_count = radv_get_layerCount(image, subresourceRange);
> -	bool old_predicating;
> +	bool old_predicating = false;
>   	VkPipeline pipeline;
>   
>   	assert(cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL);
>