On Thu, Jan 08, 2015 at 12:04:20PM +0100, walter harms wrote:
> > @@ -1844,10 +1844,11 @@ static int coda_register_device(struct coda_dev
> > *dev, int i)
> > {
> > struct video_device *vfd = &dev->vfd[i];
> >
> > - if (i > ARRAY_SIZE(dev->vfd))
> > + if (i >= dev->devtype->num_vdevs)
> > return -EINVAL;
>
> hi,
> just a minor question. if i can not be trusted, i feel you should move the
> array access:
> struct video_device *vfd = &dev->vfd[i];
> after the check
> i >= dev->devtype->num_vdevs
> at least that would improve the readability by not trigger my internal alarm
> "check after access"
The "access" is just taking the address, not dereferencing so it's ok.
This kind of code is fairly common and CodingStyle doesn't have an
opinion here so I left it how the original author wrote it.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html