Patchwork [2/3] PCI, acpiphp: Use list_for_each_entry_safe instead of list_for_each_entry

login
register
mail settings
Submitter Yijing Wang
Date Aug. 16, 2012, 12:12 p.m.
Message ID <1345119142-5896-2-git-send-email-wangyijing@huawei.com>
Download mbox | patch
Permalink /patch/177969/
State Rejected
Headers show

Comments

Yijing Wang - Aug. 16, 2012, 12:12 p.m.
list_for_each_entry is not safe, use list_for_each_entry_safe fix this.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index a372ade..7bbd6bf 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)
  */
 static void acpiphp_sanitize_bus(struct pci_bus *bus)
 {
-	struct pci_dev *dev;
+	struct pci_dev *dev, *tmp;
 	int i;
 	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++) {
 			struct resource *res = &dev->resource[i];
 			if ((res->flags & type_mask) && !res->start &&