Date: Thu, 21 Apr 2016 15:24:21 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298409 - head/sys/dev/siba Message-ID: <201604211524.u3LFOLMX023094@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604211524.u3LFOLMX023094>