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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to