Make WARNS=6 safe.

Tested with Clang 3.7.1, GCC 4.2.1 and GCC 4.8.5 on amd64.
This commit is contained in:
Stefan Eßer 2016-02-18 15:23:25 +00:00
parent 787db28adf
commit a4ed9e4f78
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295760
3 changed files with 19 additions and 10 deletions

View File

@ -5,6 +5,4 @@ PROG= pciconf
SRCS= pciconf.c cap.c err.c
MAN= pciconf.8
WARNS?= 3
.include <bsd.prog.mk>

View File

@ -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[] = {

View File

@ -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)