svn commit: r327581 - head/usr.sbin/pciconf

Warner Losh imp at FreeBSD.org
Fri Jan 5 07:29:04 UTC 2018


Author: imp
Date: Fri Jan  5 07:29:02 2018
New Revision: 327581
URL: https://svnweb.freebsd.org/changeset/base/327581

Log:
  Remove dead code (comma is either 0 or 1 for sure, no need to test).
  Close /dev/pci when we're done with it.
  
  CID: 1007450, 1007449, 1008615, 1008614

Modified:
  head/usr.sbin/pciconf/cap.c
  head/usr.sbin/pciconf/pciconf.c

Modified: head/usr.sbin/pciconf/cap.c
==============================================================================
--- head/usr.sbin/pciconf/cap.c	Fri Jan  5 07:28:58 2018	(r327580)
+++ head/usr.sbin/pciconf/cap.c	Fri Jan  5 07:29:02 2018	(r327581)
@@ -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: head/usr.sbin/pciconf/pciconf.c
==============================================================================
--- head/usr.sbin/pciconf/pciconf.c	Fri Jan  5 07:28:58 2018	(r327580)
+++ head/usr.sbin/pciconf/pciconf.c	Fri Jan  5 07:29:02 2018	(r327581)
@@ -1005,6 +1005,7 @@ writeit(const char *name, const char *reg, const char 
 
 	if (ioctl(fd, PCIOCWRITE, &pi) < 0)
 		err(1, "ioctl(PCIOCWRITE)");
+	close(fd);
 }
 
 static void
@@ -1024,4 +1025,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);
 }


More information about the svn-src-all mailing list