Skip to contentSkip to conversation

ATI FB driver: fix variable size warnings

PATCH New Davidlohr Bueso 1 participant 1 message Oct 19, 2010 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ATI FB driver: fix variable size warnings

ATI FB driver: fix variable size warnings and get rid of two unused variables.

Basically revert the order of the for-loop and get rid of the ARRAY_SIZE()-1 bit, which causes the warning. The iterations produce the exact same result: exit if the PCI id is found. Otherwise (if no device is found, then 'i' should be the same value of the size of the amount of elements in the array). My current randconfig showed the following:

drivers/video/aty/atyfb_base.c: In function ‘correct_chipset’:
drivers/video/aty/atyfb_base.c:441: warning: overflow in implicit constant conversion

This is compile-tested only.

PS: Not sure who deals with this, so please include CC if you know.

Thanks.
Davidlohr

---
 drivers/video/aty/atyfb_base.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
drivers/video/aty/atyfb_base.c +4 -6
index f8d69ad..7771142 100644
@@ -436,13 +436,13 @@ static int __devinit correct_chipset(struct atyfb_par *par)
 	u16 type;
 	u32 chip_id;
 	const char *name;
-	int i;
-
-	for (i = ARRAY_SIZE(aty_chips) - 1; i >= 0; i--)
+	int i, arrsize = ARRAY_SIZE(aty_chips);
+	
+	for (i = 0; i < arrsize; i++)
 		if (par->pci_id == aty_chips[i].pci_id)
 			break;
 
-	if (i < 0)
+	if (i == arrsize)
 		return -ENODEV;
 
 	name = aty_chips[i].name;
@@ -535,8 +535,6 @@ static int __devinit correct_chipset(struct atyfb_par *par)
 	return 0;
 }
 
-static char ram_dram[] __devinitdata = "DRAM";
-static char ram_resv[] __devinitdata = "RESV";
 #ifdef CONFIG_FB_ATY_GX
 static char ram_vram[] __devinitdata = "VRAM";
 #endif /* CONFIG_FB_ATY_GX */
Signature · 1 line
1.7.0.4