v3dv: Remove unsigned comparison to zero.
authorVinson Lee <vlee@freedesktop.org>
Tue, 10 Nov 2020 01:17:05 +0000 (17:17 -0800)
committerVinson Lee <vlee@freedesktop.org>
Sat, 14 Nov 2020 00:54:09 +0000 (16:54 -0800)
index is of type uint32_t.

Fix defects reported by Coverity Scan.

Macro compares unsigned to 0 (NO_EFFECT)
unsigned_compare: This greater-than-or-equal-to-zero comparison of
an unsigned value is always true. index >= 0U.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7518>

src/broadcom/vulkan/v3dv_descriptor_set.c

index 89657ce..5cb7e96 100644 (file)
@@ -130,7 +130,7 @@ v3dv_descriptor_map_get_descriptor_bo(struct v3dv_descriptor_state *descriptor_s
                                       uint32_t index,
                                       VkDescriptorType *out_type)
 {
-   assert(index >= 0 && index < map->num_desc);
+   assert(index < map->num_desc);
 
    uint32_t set_number = map->set[index];
    assert(descriptor_state->valid & 1 << set_number);
@@ -172,7 +172,7 @@ v3dv_descriptor_map_get_sampler(struct v3dv_descriptor_state *descriptor_state,
                                 struct v3dv_pipeline_layout *pipeline_layout,
                                 uint32_t index)
 {
-   assert(index >= 0 && index < map->num_desc);
+   assert(index < map->num_desc);
 
    uint32_t set_number = map->set[index];
    assert(descriptor_state->valid & 1 << set_number);