Commit 4e0d77f8 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Bjorn Helgaas

PCI/VPD: Treat initial 0xff as missing EEPROM

Previously we assumed that the first tag being 0x00 meant an EEPROM was
missing.  The first tag being 0xff means the same thing; check for that
also.

[bhelgaas: rework error mesage]
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
parent 70730db0
...@@ -78,10 +78,8 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size) ...@@ -78,10 +78,8 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
while (off < old_size && pci_read_vpd(dev, off, 1, header) == 1) { while (off < old_size && pci_read_vpd(dev, off, 1, header) == 1) {
unsigned char tag; unsigned char tag;
if (!header[0] && !off) { if (off == 0 && (header[0] == 0x00 || header[0] == 0xff))
pci_info(dev, "Invalid VPD tag 00, assume missing optional VPD EPROM\n"); goto error;
return 0;
}
if (header[0] & PCI_VPD_LRDT) { if (header[0] & PCI_VPD_LRDT) {
/* Large Resource Data Type Tag */ /* Large Resource Data Type Tag */
...@@ -113,6 +111,12 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size) ...@@ -113,6 +111,12 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
} }
} }
return 0; return 0;
error:
pci_info(dev, "invalid VPD tag %#04x at offset %zu%s\n",
header[0], off, off == 0 ?
"; assume missing optional EEPROM" : "");
return 0;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment