[PATCH 3/3] Fix logic error in radeon_kms_update_vram_limit().

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


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

Pointed out 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 |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 261e1cb..5f315a9 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1554,16 +1554,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