aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2013-04-12 01:44:17 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-04-12 17:38:25 -0400
commitd65eba6a7a769bb939303969267cbf1c916358f5 (patch)
treea440a76282198945d081550115861a6f6e820048
parent981cf9ea9a6a6c422e51fc04bedad00b7792ccbc (diff)
PCI: acpiphp: Use list_for_each_entry_safe() in acpiphp_sanitize_bus()
Function acpiphp_sanitize_bus() may call pci_stop_and_remove_bus_device(), which in turn may remove device from bus->devices list. So walk the bus->devices list with list_for_each_entry_safe(). Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Yinghai Lu <yinghai@kernel.org> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Toshi Kani <toshi.kani@hp.com>
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 270fdbadc19c..7948bc919605 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1082,11 +1082,11 @@ static void acpiphp_set_hpp_values(struct pci_bus *bus)
1082 */ 1082 */
1083static void acpiphp_sanitize_bus(struct pci_bus *bus) 1083static void acpiphp_sanitize_bus(struct pci_bus *bus)
1084{ 1084{
1085 struct pci_dev *dev; 1085 struct pci_dev *dev, *tmp;
1086 int i; 1086 int i;
1087 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; 1087 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM;
1088 1088
1089 list_for_each_entry(dev, &bus->devices, bus_list) { 1089 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
1090 for (i=0; i<PCI_BRIDGE_RESOURCES; i++) { 1090 for (i=0; i<PCI_BRIDGE_RESOURCES; i++) {
1091 struct resource *res = &dev->resource[i]; 1091 struct resource *res = &dev->resource[i];
1092 if ((res->flags & type_mask) && !res->start && 1092 if ((res->flags & type_mask) && !res->start &&