summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2018-03-15 05:04:46 +0000
committereadler <eadler@FreeBSD.org>2018-03-15 05:04:46 +0000
commite6d0e45546f68b5ee2a376c1e662929d8028f80a (patch)
treed628b8966f1721921769d7e38fdda8bf70f5a478 /usr.sbin
parentbb240ed5de8267b107dbe550d27bc2a8d6a9bf6a (diff)
downloadFreeBSD-src-e6d0e45546f68b5ee2a376c1e662929d8028f80a.zip
FreeBSD-src-e6d0e45546f68b5ee2a376c1e662929d8028f80a.tar.gz
MFC r327580,r327581:
bits is never null when we call ot. Add an assert to that effect and remove test for NULL. Remove dead code (comma is either 0 or 1 for sure, no need to test). Close /dev/pci when we're done with it.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ifmcstat/printb.c4
-rw-r--r--usr.sbin/pciconf/cap.c8
-rw-r--r--usr.sbin/pciconf/pciconf.c2
3 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/ifmcstat/printb.c b/usr.sbin/ifmcstat/printb.c
index d97d496..a02f552 100644
--- a/usr.sbin/ifmcstat/printb.c
+++ b/usr.sbin/ifmcstat/printb.c
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <assert.h>
#include <stdio.h>
/*
@@ -43,7 +44,8 @@ printb(const char *s, unsigned int v, const char *bits)
int i, any = 0;
char c;
- if (bits && *bits == 8)
+ assert(bits != NULL);
+ if (*bits == 8)
printf("%s=%o", s, v);
else
printf("%s=%x", s, v);
diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c
index d8c5185..03490e4 100644
--- a/usr.sbin/pciconf/cap.c
+++ b/usr.sbin/pciconf/cap.c
@@ -161,7 +161,7 @@ cap_pcix(int fd, struct pci_conf *p, uint8_t ptr)
printf("supports");
comma = 0;
if (status & PCIXM_STATUS_133CAP) {
- printf("%s 133MHz", comma ? "," : "");
+ printf(" 133MHz");
comma = 1;
}
if (status & PCIXM_STATUS_266CAP) {
@@ -351,10 +351,8 @@ cap_vendor(int fd, struct pci_conf *p, uint8_t ptr)
printf("%s SATA RAID-0/1/10", comma ? "," : "");
comma = 1;
}
- if (fvec & (1 << 3)) {
- printf("%s SATA AHCI", comma ? "," : "");
- comma = 1;
- }
+ if (fvec & (1 << 3))
+ printf(", SATA AHCI");
}
}
}
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index bfbcf74..e33cdb2 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -1001,6 +1001,7 @@ writeit(const char *name, const char *reg, const char *data, int width)
if (ioctl(fd, PCIOCWRITE, &pi) < 0)
err(1, "ioctl(PCIOCWRITE)");
+ close(fd);
}
static void
@@ -1020,4 +1021,5 @@ chkattached(const char *name)
exitstatus = pi.pi_data ? 0 : 2; /* exit(2), if NOT attached */
printf("%s: %s%s\n", name, pi.pi_data == 0 ? "not " : "", "attached");
+ close(fd);
}
OpenPOWER on IntegriCloud