diff options
author | Martin Mares <mj@ucw.cz> | 2006-09-10 17:34:45 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2006-09-10 17:34:45 +0200 |
commit | 934e7e36f9cd6f4bd39f9666a4f4d0ad1b0c91eb (patch) | |
tree | 41255624bd1db30fd0bd542d48dbf857df5fe0df | |
parent | 2e5040083e408c50bd444a8b9cb404bae39c222b (diff) | |
download | pciutils-934e7e36f9cd6f4bd39f9666a4f4d0ad1b0c91eb.tar.gz |
Errors when reading standard config header are no longer fatal.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lspci.c | 10 |
2 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2006-09-10 Martin Mares <mj@ucw.cz> + + * lspci.c (scan_device): If an error occurs when reading the standard config + header of a device, report it and ignore the device and return with exit + code 2 at the end. + 2006-09-09 Martin Mares <mj@ucw.cz> * Released as 2.2.4. @@ -75,6 +75,7 @@ struct device { }; static struct device *first_dev; +static int seen_errors; static int config_fetch(struct device *d, unsigned int pos, unsigned int len) @@ -121,7 +122,12 @@ scan_device(struct pci_dev *p) d->present = xmalloc(64); memset(d->present, 1, 64); if (!pci_read_block(p, 0, d->config, 64)) - die("Unable to read the standard configuration space header"); + { + fprintf(stderr, "lspci: Unable to read the standard configuration space header of device %04x:%02x:%02x.%d\n", + p->domain, p->bus, p->dev, p->func); + seen_errors++; + return NULL; + } if ((d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS) { /* For cardbus bridges, we need to fetch 64 bytes more to get the @@ -2401,5 +2407,5 @@ main(int argc, char **argv) } pci_cleanup(pacc); - return 0; + return (seen_errors ? 2 : 0); } |