[PATCH] ATI FB driver: fix variable size warnings

From: Davidlohr Bueso
Date: Tue Oct 19 2010 - 12:54:11 EST


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

Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
---
drivers/video/aty/atyfb_base.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index f8d69ad..7771142 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -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 */
--
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/