[Mesa-dev] [PATCH 2/2] winsys/amdgpu: clean up and fix switch statement

Grigori Goronzy greg at chown.ath.cx
Tue Apr 19 23:13:43 UTC 2016


Add missing break, add default case. Additionally initialize variables
to avoid compiler warnings.
---
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index b9a7c5b..d978a0d 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -202,12 +202,13 @@ static bool amdgpu_get_new_ib(struct radeon_winsys *ws, struct amdgpu_ib *ib,
                               struct amdgpu_cs_ib_info *info, unsigned ib_type)
 {
    struct amdgpu_winsys *aws = (struct amdgpu_winsys *)ws;
-   unsigned buffer_size, ib_size;
+   unsigned buffer_size = 0, ib_size = 0;
 
    switch (ib_type) {
    case IB_CONST_PREAMBLE:
       buffer_size = 4 * 1024 * 4;
       ib_size = 1024 * 4;
+      break;
    case IB_CONST:
       buffer_size = 512 * 1024 * 4;
       ib_size = 128 * 1024 * 4;
@@ -225,6 +226,9 @@ static bool amdgpu_get_new_ib(struct radeon_winsys *ws, struct amdgpu_ib *ib,
       ib_size = 32 * 1024 * 4;
       if (aws->buffer_wait_time_avg > IB_SIZE_WAIT_THRESHOLD_NS)
          ib_size = 10 * 1024 * 4;
+      break;
+   default:
+      assert(!"unreachable");
    }
 
    ib->base.cdw = 0;
-- 
1.9.1



More information about the mesa-dev mailing list