Fix error in pci_find_class().
authorKevin O'Connor <kevin@koconnor.net>
Thu, 10 Jul 2008 02:43:23 +0000 (22:43 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 10 Jul 2008 02:43:23 +0000 (22:43 -0400)
Fix biterror - must shift value read from pci space - otherwise stray
    bits may be set and cause comparison to fail.

src/pci.c

index e704444cf6ee9205bd0cf8bbdf1aa92493c5897c..efcab46e545aaeb43092e740705d18d90b440272 100644 (file)
--- a/src/pci.c
+++ b/src/pci.c
@@ -80,12 +80,11 @@ int
 pci_find_class(u32 classid, int index, PCIDevice *dev)
 {
     int devfn, bus;
-    u32 id = classid << 8;
     for (bus=0; bus < MAX_BUS; bus++) {
         for (devfn=0; devfn<0x100; devfn++) {
             PCIDevice d = pci_bd(bus, devfn);
             u32 v = pci_config_readl(d, 0x08);
-            if (v != id)
+            if ((v>>8) != classid)
                 continue;
             if (index) {
                 index--;