From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [patch -next] fb: fix recent breakage in correct_chipset()
Date: Thu, 01 Aug 2013 11:50:45 +0000 [thread overview]
Message-ID: <20130801115045.GL5002@mwanda> (raw)
In-Reply-To: <20130702062821.GC24410@elgon.mountain>
On Thu, Aug 01, 2013 at 11:31:07AM +0200, Geert Uytterhoeven wrote:
> On Tue, Jul 2, 2013 at 8:28 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > 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.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
> > index a89c15d..9b0f12c 100644
> > --- a/drivers/video/aty/atyfb_base.c
> > +++ b/drivers/video/aty/atyfb_base.c
> > @@ -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?
>
Nope. That would be a nearly-forever loop.
regards,
dan carpenter
prev parent reply other threads:[~2013-08-01 11:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 6:28 [patch -next] fb: fix recent breakage in correct_chipset() Dan Carpenter
2013-07-02 15:50 ` Randy Dunlap
2013-07-12 20:11 ` Randy Dunlap
2013-07-26 8:34 ` Tomi Valkeinen
2013-08-01 9:31 ` Geert Uytterhoeven
2013-08-01 11:50 ` Dan Carpenter [this message]
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=20130801115045.GL5002@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-fbdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.