fb: fix recent breakage in correct_chipset()
Subsystems (2)
PATCH 1/1 fb: fix recent breakage in correct_chipset()
The 6e36308a6f "fb: fix atyfb build warning" isn't right. It makes all the indexes off by one. This patch reverts it and casts the ARRAY_SIZE() to int to silence the build warning.
drivers/video/aty/atyfb_base.c +2 -2
@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par)const char *name;int i; -for (i =ARRAY_SIZE (aty_chips); i >0 ; i--) -if (par->pci_id = aty_chips[i -1 ].pci_id) +for (i = (int )ARRAY_SIZE (aty_chips) -1 ; i >=0 ; i--) +if (par->pci_id = aty_chips[i].pci_id)break ;if (i <0 )
Quoted 3 lines · Dan Carpenter
The
6e36308a6f"fb: fix atyfb build warning" isn't right. It makes all the indexes off by one. This patch reverts it and casts theARRAY_SIZE()to int to silence the build warning.
Argh. Thanks.
Quoted 18 lines
Signed-off-by Dan Carpenter <[email protected]>drivers/video/aty/atyfb_base.c +2
-2@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par)const char *name;int i; -for (i =ARRAY_SIZE (aty_chips); i >0 ; i--) -if (par->pci_id = aty_chips[i -1 ].pci_id) +for (i = (int )ARRAY_SIZE (aty_chips) -1 ; i >=0 ; i--) +if (par->pci_id = aty_chips[i].pci_id)break ;if (i <0 )
Signature · 1 line
~Randy
Quoted 5 lines · Dan Carpenter
The
6e36308a6f"fb: fix atyfb build warning" isn't right. It makes all the indexes off by one. This patch reverts it and casts theARRAY_SIZE()to int to silence the build warning.Signed-off-by Dan Carpenter <[email protected]>
Tomi,
My incorrect patch has been merged into mainline.
Please merge Dan's fix for it instead.
Thanks.
Quoted 16 lines
drivers/video/aty/atyfb_base.c +2
-2@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par)const char *name;int i; -for (i =ARRAY_SIZE (aty_chips); i >0 ; i--) -if (par->pci_id = aty_chips[i -1 ].pci_id) +for (i = (int )ARRAY_SIZE (aty_chips) -1 ; i >=0 ; i--) +if (par->pci_id = aty_chips[i].pci_id)break ;if (i <0 )
Signature · 1 line
~Randy
Quoted 12 lines · Dan Carpenter
The
6e36308a6f"fb: fix atyfb build warning" isn't right. It makes all the indexes off by one. This patch reverts it and casts theARRAY_SIZE()to int to silence the build warning.Signed-off-by Dan Carpenter <[email protected]>drivers/video/aty/atyfb_base.c +0
-0
drivers/video/aty/atyfb_base.c static int correct_chipset(struct atyfb_par *par) · line 442
Quoted 10 lines
drivers/video/aty/atyfb_base.c +2
-2@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par)const char *name;int i; -for (i =ARRAY_SIZE (aty_chips); i >0 ; i--) -if (par->pci_id == aty_chips[i -1 ].pci_id) +for (i = (int )ARRAY_SIZE (aty_chips) -1 ; i >=0 ; i--) +if (par->pci_id == aty_chips[i].pci_id)break ;if (i <0 )
Thanks, I've applied this into my 3.11-fixes/fbdev branch.
Tomi
Quoted 11 lines · Dan Carpenter
The
6e36308a6f"fb: fix atyfb build warning" isn't right. It makes all the indexes off by one. This patch reverts it and casts theARRAY_SIZE()to int to silence the build warning.Signed-off-by Dan Carpenter <[email protected]>drivers/video/aty/atyfb_base.c +0
-0
drivers/video/aty/atyfb_base.c static int correct_chipset(struct atyfb_par *par) · line 442
Quoted 10 lines
drivers/video/aty/atyfb_base.c +2
-2@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par)const char *name;int i; -for (i =ARRAY_SIZE (aty_chips); i >0 ; i--) -if (par->pci_id = aty_chips[i -1 ].pci_id) +for (i = (int )ARRAY_SIZE (aty_chips) -1 ; i >=0 ; i--) +if (par->pci_id = aty_chips[i].pci_id)break ;if (i <0 )
Sorry for chiming in late, but can't we just revert the order of the loop iteration and change i from int to size_t instead of adding a cast?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 21 lines · Geert Uytterhoeven
Quoted 20 lines · Dan Carpenter
The
6e36308a6f"fb: fix atyfb build warning" isn't right. It makes all the indexes off by one. This patch reverts it and casts theARRAY_SIZE()to int to silence the build warning.Signed-off-by Dan Carpenter <[email protected]>drivers/video/aty/atyfb_base.c +2
-2@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par)const char *name;int i; -for (i =ARRAY_SIZE (aty_chips); i >0 ; i--) -if (par->pci_id = aty_chips[i -1 ].pci_id) +for (i = (int )ARRAY_SIZE (aty_chips) -1 ; i >=0 ; i--) +if (par->pci_id = aty_chips[i].pci_id)break ;
Quoted 5 lines
drivers/video/aty/atyfb_base.c static int correct_chipset(struct atyfb_par *par) · line 442
Quoted 1 line
drivers/video/aty/atyfb_base.c +0
-0if (i <0 )Sorry for chiming in late, but can't we just revert the order of the loop iteration and change i from int to
size_tinstead of adding a cast?
Nope. That would be a nearly-forever loop.
regards,
dan carpenter