Commit d65eba6a authored by Yijing Wang's avatar Yijing Wang Committed by Bjorn Helgaas

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: default avatarYijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarYinghai Lu <yinghai@kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Toshi Kani <toshi.kani@hp.com>
parent 981cf9ea
...@@ -1082,11 +1082,11 @@ static void acpiphp_set_hpp_values(struct pci_bus *bus) ...@@ -1082,11 +1082,11 @@ static void acpiphp_set_hpp_values(struct pci_bus *bus)
*/ */
static void acpiphp_sanitize_bus(struct pci_bus *bus) static void acpiphp_sanitize_bus(struct pci_bus *bus)
{ {
struct pci_dev *dev; struct pci_dev *dev, *tmp;
int i; int i;
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM;
list_for_each_entry(dev, &bus->devices, bus_list) { list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
for (i=0; i<PCI_BRIDGE_RESOURCES; i++) { for (i=0; i<PCI_BRIDGE_RESOURCES; i++) {
struct resource *res = &dev->resource[i]; struct resource *res = &dev->resource[i];
if ((res->flags & type_mask) && !res->start && if ((res->flags & type_mask) && !res->start &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment