winsys/amdgpu: init buffer_indices_hashlist with memset()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 14 Apr 2017 16:32:25 +0000 (18:32 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 17 Apr 2017 09:59:17 +0000 (11:59 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c

index f068d8ea7a85876f3efe78f7be961ac69178806b..8a277d08e13347453e1457239abde517bac67c9d 100644 (file)
@@ -695,8 +695,6 @@ static void amdgpu_ib_finalize(struct amdgpu_ib *ib)
 static bool amdgpu_init_cs_context(struct amdgpu_cs_context *cs,
                                    enum ring_type ring_type)
 {
-   int i;
-
    switch (ring_type) {
    case RING_DMA:
       cs->request.ip_type = AMDGPU_HW_IP_DMA;
@@ -720,9 +718,7 @@ static bool amdgpu_init_cs_context(struct amdgpu_cs_context *cs,
       break;
    }
 
-   for (i = 0; i < ARRAY_SIZE(cs->buffer_indices_hashlist); i++) {
-      cs->buffer_indices_hashlist[i] = -1;
-   }
+   memset(cs->buffer_indices_hashlist, -1, sizeof(cs->buffer_indices_hashlist));
    cs->last_added_bo = NULL;
 
    cs->request.number_of_ibs = 1;
@@ -757,9 +753,7 @@ static void amdgpu_cs_context_cleanup(struct amdgpu_cs_context *cs)
    cs->num_sparse_buffers = 0;
    amdgpu_fence_reference(&cs->fence, NULL);
 
-   for (i = 0; i < ARRAY_SIZE(cs->buffer_indices_hashlist); i++) {
-      cs->buffer_indices_hashlist[i] = -1;
-   }
+   memset(cs->buffer_indices_hashlist, -1, sizeof(cs->buffer_indices_hashlist));
    cs->last_added_bo = NULL;
 }