BIT(7) of dev->hdr_type has unrelated information. Mask out the upper bit so that the capabilities can properly be found. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/pci/pci.c | 4 ++-- include/linux/pci_regs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 638af9722e..0211fc0081 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -428,7 +428,7 @@ static unsigned int pci_scan_bus(struct pci_bus *bus) pr_debug("%02x:%02x [%04x:%04x]\n", bus->number, dev->devfn, dev->vendor, dev->device); - switch (hdr_type & 0x7f) { + switch (hdr_type & PCI_HEADER_TYPE_MASK) { case PCI_HEADER_TYPE_NORMAL: if (class == PCI_CLASS_BRIDGE_PCI) goto bad; @@ -642,7 +642,7 @@ u8 pci_find_capability(struct pci_dev *dev, int cap) { u8 pos; - pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type); + pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type & PCI_HEADER_TYPE_MASK); if (pos) pos = __pci_find_next_cap(dev->bus, dev->devfn, pos, cap); diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 2c335f5835..631f218229 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h @@ -69,6 +69,7 @@ #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ #define PCI_HEADER_TYPE 0x0e /* 8 bits */ +#define PCI_HEADER_TYPE_MASK 0x7f #define PCI_HEADER_TYPE_NORMAL 0 #define PCI_HEADER_TYPE_BRIDGE 1 #define PCI_HEADER_TYPE_CARDBUS 2 -- 2.39.2