summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorse <se@FreeBSD.org>2016-02-18 15:23:25 +0000
committerse <se@FreeBSD.org>2016-02-18 15:23:25 +0000
commit94a9d119b90ec02be281c7d3cdc4afc367eb6585 (patch)
tree84964f73ff2dcbdea474c4dee504baac7a0ff221 /usr.sbin
parentd727dc043e06390530c308d75fec9a7018fdf8c9 (diff)
downloadFreeBSD-src-94a9d119b90ec02be281c7d3cdc4afc367eb6585.zip
FreeBSD-src-94a9d119b90ec02be281c7d3cdc4afc367eb6585.tar.gz
Make WARNS=6 safe.
Tested with Clang 3.7.1, GCC 4.2.1 and GCC 4.8.5 on amd64.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pciconf/Makefile2
-rw-r--r--usr.sbin/pciconf/cap.c10
-rw-r--r--usr.sbin/pciconf/pciconf.c17
3 files changed, 19 insertions, 10 deletions
diff --git a/usr.sbin/pciconf/Makefile b/usr.sbin/pciconf/Makefile
index a839733..e288654 100644
--- a/usr.sbin/pciconf/Makefile
+++ b/usr.sbin/pciconf/Makefile
@@ -5,6 +5,4 @@ PROG= pciconf
SRCS= pciconf.c cap.c err.c
MAN= pciconf.8
-WARNS?= 3
-
.include <bsd.prog.mk>
diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c
index 9ab6dd1..25132cd 100644
--- a/usr.sbin/pciconf/cap.c
+++ b/usr.sbin/pciconf/cap.c
@@ -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, uint8_t ptr)
}
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, uint8_t ptr)
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, uint16_t ptr, uint8_t ver)
print_bar(fd, p, "iov bar ", ptr + PCIR_SRIOV_BAR(i));
}
-struct {
+static struct {
uint16_t id;
const char *name;
} ecap_names[] = {
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 194da6b..85b5e87 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -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)
OpenPOWER on IntegriCloud