Date: Thu, 15 Mar 2018 05:04:46 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330968 - in stable/11/usr.sbin: ifmcstat pciconf Message-ID: <201803150504.w2F54ks2022958@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Thu Mar 15 05:04:46 2018 New Revision: 330968 URL: https://svnweb.freebsd.org/changeset/base/330968 Log: 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. Modified: stable/11/usr.sbin/ifmcstat/printb.c stable/11/usr.sbin/pciconf/cap.c stable/11/usr.sbin/pciconf/pciconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/ifmcstat/printb.c ============================================================================== --- stable/11/usr.sbin/ifmcstat/printb.c Thu Mar 15 04:59:47 2018 (r330967) +++ stable/11/usr.sbin/ifmcstat/printb.c Thu Mar 15 05:04:46 2018 (r330968) @@ -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); Modified: stable/11/usr.sbin/pciconf/cap.c ============================================================================== --- stable/11/usr.sbin/pciconf/cap.c Thu Mar 15 04:59:47 2018 (r330967) +++ stable/11/usr.sbin/pciconf/cap.c Thu Mar 15 05:04:46 2018 (r330968) @@ -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"); } } } Modified: stable/11/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/11/usr.sbin/pciconf/pciconf.c Thu Mar 15 04:59:47 2018 (r330967) +++ stable/11/usr.sbin/pciconf/pciconf.c Thu Mar 15 05:04:46 2018 (r330968) @@ -1001,6 +1001,7 @@ writeit(const char *name, const char *reg, const char 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803150504.w2F54ks2022958>