Skip to contentSkip to conversation

riva CalcStateExt gcc 4.1 warning fix

PATCH In review Daniel Walker 2 participants 2 messages May 10, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riva CalcStateExt gcc 4.1 warning fix

This could be a bug. The return from CalcVClock isn't checked so the variables in questions could be random data ..

Fixes the following warning,

drivers/video/riva/riva_hw.c: In function 'CalcStateExt':
drivers/video/riva/riva_hw.c:1241: warning: 'p' may be used uninitialized in this function drivers/video/riva/riva_hw.c:1241: warning: 'n' may be used uninitialized in this function drivers/video/riva/riva_hw.c:1241: warning: 'm' may be used uninitialized in this function drivers/video/riva/riva_hw.c:1241: warning: 'VClk' may be used uninitialized in this function

drivers/video/riva/riva_hw.c +6 -1
Index: linux-2.6.16/drivers/video/riva/riva_hw.c
===================================================================
@@ -1238,7 +1238,12 @@ static void CalcStateExt
     int            dotClock
 )
 {
-    int pixelDepth, VClk, m, n, p;
+    int pixelDepth;
+    int VClk = 0;
+    int m = 0;
+    int n = 0;
+    int p = 0;
+
     /*
      * Save mode parameters.
      */
#1 lore raw
Quoted 10 lines · Daniel Walker

This could be a bug. The return from CalcVClock isn't checked so the variables in questions could be random data ..

Fixes the following warning,

drivers/video/riva/riva_hw.c: In function 'CalcStateExt':
drivers/video/riva/riva_hw.c:1241: warning: 'p' may be used uninitialized in this function drivers/video/riva/riva_hw.c:1241: warning: 'n' may be used uninitialized in this function drivers/video/riva/riva_hw.c:1241: warning: 'm' may be used uninitialized in this function drivers/video/riva/riva_hw.c:1241: warning: 'VClk' may be used uninitialized in this function

But zero isn't valid data. You need to fix the missing return check not hide the warnings. This goes for just about every patch in this series