PCI: check if bus has a proper bridge device before triggering SBR
authorYu Zhao <yu.zhao@intel.com>
Fri, 26 Jun 2009 06:04:46 +0000 (14:04 +0800)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Mon, 29 Jun 2009 19:13:13 +0000 (12:13 -0700)
For devices attached to the root bus, we can't trigger Secondary Bus
Reset because there is no bridge device associated with the bus. So
need to check bus->self again NULL first before using it.

Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/pci.c

index 6c93af5..d5d6f56 100644 (file)
@@ -2171,7 +2171,7 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
        u16 ctrl;
        struct pci_dev *pdev;
 
-       if (dev->subordinate)
+       if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self)
                return -ENOTTY;
 
        list_for_each_entry(pdev, &dev->bus->devices, bus_list)