From: Davidlohr Bueso <dave.bueso@gmail.com>
To: Paul Mackerras <paulus@samba.org>,
grant.likely@secretlab.ca, alex.kern@gmx.de,
benh@kernel.crashing.org, mpatocka@redhat.com
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] ATI FB driver: fix variable size warnings
Date: Tue, 19 Oct 2010 13:53:52 -0300 [thread overview]
Message-ID: <1287507232.2133.12.camel@cowboy> (raw)
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@gnu.org>
---
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
reply other threads:[~2010-10-19 16:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287507232.2133.12.camel@cowboy \
--to=dave.bueso@gmail.com \
--cc=alex.kern@gmx.de \
--cc=benh@kernel.crashing.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox