svn commit: r298409 - head/sys/dev/siba
Pedro F. Giffuni
pfg at FreeBSD.org
Thu Apr 21 15:24:22 UTC 2016
Author: pfg
Date: Thu Apr 21 15:24:21 2016
New Revision: 298409
URL: https://svnweb.freebsd.org/changeset/base/298409
Log:
siba(4): remove slightly used 'bound' variable.
It can be replaced with nitems(). While here simplify the function
Suggested by: jhb
Modified:
head/sys/dev/siba/siba.c
Modified: head/sys/dev/siba/siba.c
==============================================================================
--- head/sys/dev/siba/siba.c Thu Apr 21 15:06:53 2016 (r298408)
+++ head/sys/dev/siba/siba.c Thu Apr 21 15:24:21 2016 (r298409)
@@ -337,22 +337,19 @@ siba_attach(device_t dev)
static struct siba_devid *
siba_dev_match(uint16_t vid, uint16_t devid, uint8_t rev)
{
- size_t i, bound;
+ size_t i;
struct siba_devid *sd;
- bound = sizeof(siba_devids) / sizeof(struct siba_devid);
sd = &siba_devids[0];
- for (i = 0; i < bound; i++, sd++) {
+ for (i = 0; i < nitems(siba_devids); i++, sd++) {
if (((vid == SIBA_VID_ANY) || (vid == sd->sd_vendor)) &&
((devid == SIBA_DEVID_ANY) || (devid == sd->sd_device)) &&
((rev == SIBA_REV_ANY) || (rev == sd->sd_rev) ||
(sd->sd_rev == SIBA_REV_ANY)))
- break;
+ return(sd);
}
- if (i == bound)
- sd = NULL;
- return (sd);
+ return (NULL);
}
static int
More information about the svn-src-head
mailing list