diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-02-20 02:50:12 +0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-02-24 00:05:59 +0400 |
commit | 2dd8ba921d570fcd016f8038c63fa9668892d16b (patch) | |
tree | f2ff01098ed51ee0b6682f91c1b9bf628c84f848 /drivers/pci | |
parent | 9ad52e63db1bc588636bc66b9133498c46e6535c (diff) | |
download | linux-2dd8ba921d570fcd016f8038c63fa9668892d16b.tar.xz |
PCI: Fix device class print out
Found debug print of class is shifted.
| pci 0000:f8:15.2: [8086:2b56] type 0 class 0x000600
Code is trying to print class with 6 digits, but use shifted class with
4 digits valid value as variable.
Change to original dev->class directly.
Also remove not needed calculating of local variable class, because it
will be updated after pci_fixup_device(pci_fixup_early...)
Also unify type print out when class and header is not matched.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/probe.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 9f2ff8c5dc2f..aa9b1dec0d3e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -926,12 +926,10 @@ int pci_setup_device(struct pci_dev *dev) pci_read_config_dword(dev, PCI_CLASS_REVISION, &class); dev->revision = class & 0xff; - class >>= 8; /* upper 3 bytes */ - dev->class = class; - class >>= 8; + dev->class = class >> 8; /* upper 3 bytes */ - dev_printk(KERN_DEBUG, &dev->dev, "[%04x:%04x] type %d class %#08x\n", - dev->vendor, dev->device, dev->hdr_type, class); + dev_printk(KERN_DEBUG, &dev->dev, "[%04x:%04x] type %02x class %#08x\n", + dev->vendor, dev->device, dev->hdr_type, dev->class); /* need to have dev->class ready */ dev->cfg_size = pci_cfg_space_size(dev); @@ -1013,8 +1011,8 @@ int pci_setup_device(struct pci_dev *dev) return -EIO; bad: - dev_err(&dev->dev, "ignoring class %02x (doesn't match header " - "type %02x)\n", class, dev->hdr_type); + dev_err(&dev->dev, "ignoring class %#08x (doesn't match header " + "type %02x)\n", dev->class, dev->hdr_type); dev->class = PCI_CLASS_NOT_DEFINED; } |