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

Stefan Esser se at FreeBSD.org
Thu Feb 18 15:23:27 UTC 2016


Author: se
Date: Thu Feb 18 15:23:25 2016
New Revision: 295760
URL: https://svnweb.freebsd.org/changeset/base/295760

Log:
  Make WARNS=6 safe.
  
  Tested with Clang 3.7.1, GCC 4.2.1 and GCC 4.8.5 on amd64.

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

Modified: head/usr.sbin/pciconf/Makefile
==============================================================================
--- head/usr.sbin/pciconf/Makefile	Thu Feb 18 15:12:52 2016	(r295759)
+++ head/usr.sbin/pciconf/Makefile	Thu Feb 18 15:23:25 2016	(r295760)
@@ -5,6 +5,4 @@ PROG=	pciconf
 SRCS=	pciconf.c cap.c err.c
 MAN=	pciconf.8
 
-WARNS?=	3
-
 .include <bsd.prog.mk>

Modified: head/usr.sbin/pciconf/cap.c
==============================================================================
--- head/usr.sbin/pciconf/cap.c	Thu Feb 18 15:12:52 2016	(r295759)
+++ head/usr.sbin/pciconf/cap.c	Thu Feb 18 15:23:25 2016	(r295760)
@@ -120,6 +120,9 @@ static void
 cap_vpd(int fd, struct pci_conf *p, uint8_t ptr)
 {
 
+	(void)fd;	/* UNUSED */
+	(void)p;	/* UNUSED */
+	(void)ptr;	/* UNUSED */
 	printf("VPD");
 }
 
@@ -172,6 +175,7 @@ cap_pcix(int fd, struct pci_conf *p, uin
 	}
 	if ((p->pc_hdr & PCIM_HDRTYPE) == 1)
 		return;
+	max_burst_read = 0;
 	switch (status & PCIXM_STATUS_MAX_READ) {
 	case PCIXM_STATUS_MAX_READ_512:
 		max_burst_read = 512;
@@ -186,6 +190,7 @@ cap_pcix(int fd, struct pci_conf *p, uin
 		max_burst_read = 4096;
 		break;
 	}
+	max_splits = 0;
 	switch (status & PCIXM_STATUS_MAX_SPLITS) {
 	case PCIXM_STATUS_MAX_SPLITS_1:
 		max_splits = 1;
@@ -518,6 +523,9 @@ static void
 cap_sata(int fd, struct pci_conf *p, uint8_t ptr)
 {
 
+	(void)fd;	/* UNUSED */
+	(void)p;	/* UNUSED */
+	(void)ptr;	/* UNUSED */
 	printf("SATA Index-Data Pair");
 }
 
@@ -759,7 +767,7 @@ ecap_sriov(int fd, struct pci_conf *p, u
 		print_bar(fd, p, "iov bar  ", ptr + PCIR_SRIOV_BAR(i));
 }
 
-struct {
+static struct {
 	uint16_t id;
 	const char *name;
 } ecap_names[] = {

Modified: head/usr.sbin/pciconf/pciconf.c
==============================================================================
--- head/usr.sbin/pciconf/pciconf.c	Thu Feb 18 15:12:52 2016	(r295759)
+++ head/usr.sbin/pciconf/pciconf.c	Thu Feb 18 15:23:25 2016	(r295760)
@@ -67,7 +67,7 @@ struct pci_vendor_info
     char				*desc;
 };
 
-TAILQ_HEAD(,pci_vendor_info)	pci_vendors;
+static TAILQ_HEAD(,pci_vendor_info)	pci_vendors;
 
 static struct pcisel getsel(const char *str);
 static void list_bridge(int fd, struct pci_conf *p);
@@ -896,16 +896,18 @@ getdevice(const char *name)
 static struct pcisel
 parsesel(const char *str)
 {
-	char *ep = strchr(str, '@');
-	char *epbase;
+	const char *ep;
+	const char *epbase;
+	char *eppos;
 	struct pcisel sel;
 	unsigned long selarr[4];
 	int i;
 
-	if (ep == NULL)
-		ep = (char *)str;
-	else
+	ep = strchr(str, '@');
+	if (ep != NULL)
 		ep++;
+	else
+		ep = str;
 
 	epbase = ep;
 
@@ -913,7 +915,8 @@ parsesel(const char *str)
 		ep += 3;
 		i = 0;
 		do {
-			selarr[i++] = strtoul(ep, &ep, 10);
+		  selarr[i++] = strtoul(ep, &eppos, 10);
+		  ep = eppos;
 		} while ((*ep == ':' || *ep == '.') && *++ep != '\0' && i < 4);
 
 		if (i > 2)


More information about the svn-src-head mailing list