[PATCH v2] Remove local variables total_size_bytes.

Michel Dänzer michel at daenzer.net
Tue Dec 11 03:29:04 PST 2012


From: Michel Dänzer <michel.daenzer at amd.com>

Not actually used for anything. Refactoring gone wrong?

Also remove a comment that doesn't seem to make sense anymore.

Stumbled over this due to a warning by clang:

../../src/radeon_kms.c:1562:6: warning: variable 'total_size_bytes' is uninitialized when used here [-Wuninitialized]
            total_size_bytes += (64 * 4 * 64);
            ^~~~~~~~~~~~~~~~
../../src/radeon_kms.c:1557:25: note: initialize the variable 'total_size_bytes' to silence this warning
    int total_size_bytes;
                        ^
                         = 0

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/radeon_kms.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 261e1cb..bb5ef43 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1403,7 +1403,6 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
     int cpp = info->pixel_bytes;
     int screen_size;
     int pitch, base_align;
-    int total_size_bytes = 0;
     uint32_t tiling_flags = 0;
     struct radeon_surface surface;
 
@@ -1511,14 +1510,11 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
                 }
 
                 drmmode_set_cursor(pScrn, &info->drmmode, c, info->cursor_bo[c]);
-                total_size_bytes += cursor_size;
             }
         }
     }
 
     screen_size = RADEON_ALIGN(screen_size, RADEON_GPU_PAGE_SIZE);
-    /* keep area front front buffer - but don't allocate it yet */
-    total_size_bytes += screen_size;
 
     if (info->front_bo == NULL) {
         info->front_bo = radeon_bo_open(info->bufmgr, 0, screen_size,
@@ -1554,16 +1550,14 @@ void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, int new_fb_size)
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     int remain_size_bytes;
-    int total_size_bytes;
     int c;
 
     for (c = 0; c < xf86_config->num_crtc; c++) {
 	if (info->cursor_bo[c] != NULL) {
-	    total_size_bytes += (64 * 4 * 64);
+	    new_fb_size += (64 * 4 * 64);
 	}
     }
 
-    total_size_bytes += new_fb_size;
     remain_size_bytes = info->vram_size - new_fb_size;
     remain_size_bytes = (remain_size_bytes / 10) * 9;
     radeon_cs_set_limit(info->cs, RADEON_GEM_DOMAIN_VRAM, remain_size_bytes);
-- 
1.7.10.4



More information about the xorg-driver-ati mailing list