OSDN Git Service

Don't try to use bogus bridge data
authorJesse Barnes <jbarnes@virtuousgeek.org>
Tue, 30 Jun 2009 22:24:45 +0000 (15:24 -0700)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Tue, 30 Jun 2009 22:24:45 +0000 (15:24 -0700)
If, for whatever reason, we weren't able to read bridge data (therefore
leaving bridge.pci or bridge.pcmcia empty), we shouldn't try to look at
the bus data inside the pci/pcmcia struct.

src/common_bridge.c

index 2480ba8..7f26bdc 100644 (file)
@@ -270,6 +270,10 @@ pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus,
        return ENODEV;
     }
 
+    if (!priv->bridge.pci) {
+       return ENODEV;
+    }
+
     switch ((dev->device_class >> 8) & 0x0ff) {
     case 0x00:
        /* What to do for host bridges?  I'm pretty sure this isn't right.