From patchwork Fri Apr 12 15:44:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2437001 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 073EADF2A1 for ; Fri, 12 Apr 2013 15:50:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754854Ab3DLPqd (ORCPT ); Fri, 12 Apr 2013 11:46:33 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:46846 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755905Ab3DLPq0 (ORCPT ); Fri, 12 Apr 2013 11:46:26 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz11so1540409pad.30 for ; Fri, 12 Apr 2013 08:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=WC4Sax7L1QRhRHalyizB3Jb6M4UxGhORrrlBSNyj3Gw=; b=wcMtSAsQRFuTD5uqevROmY7TGx4i/ailY3z/yUr/F9xa3pmB7YQX3iq5q/yNUQxC6t mjpGwdTSc6Njypac3KhuLLlxjk58Sx8A2nQ6wtXulBTfqcPoE4AHwnntpvjUXh7jUXTr YwirENmSxSKGC+SpdOwESslm6hKacPjLwWIlb7Yon7/09lTejom14hofTz57slkMPApe msRhZFqIL4SA2YyliumSdxwof5tHS4FcnJpqiABdmCZOHOxXpGkksINJR9nznH9Zvn01 a16iEQTEsag8hdXm0d2/LwT4QAmNKJQN8GDtUmNcULmktaW4C4lvVZggzOYTxegIvTC9 Lbng== X-Received: by 10.66.233.66 with SMTP id tu2mr1094502pac.12.1365781586225; Fri, 12 Apr 2013 08:46:26 -0700 (PDT) Received: from localhost.localdomain ([114.250.74.212]) by mx.google.com with ESMTPS id wz9sm9048741pbc.5.2013.04.12.08.46.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Apr 2013 08:46:25 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , "Rafael J . Wysocki" Cc: Yijing Wang , Yinghai Lu , Jiang Liu , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Greg Kroah-Hartman , ACPI Devel Maling List , Toshi Kani , Myron Stowe , Jiang Liu , "Rafael J. Wysocki" Subject: [PATCH v9 03/16] PCI/acpiphp: use list_for_each_entry_safe() in acpiphp_sanitize_bus() Date: Fri, 12 Apr 2013 23:44:17 +0800 Message-Id: <1365781470-32379-4-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1365781470-32379-1-git-send-email-jiang.liu@huawei.com> References: <1365781470-32379-1-git-send-email-jiang.liu@huawei.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Yijing Wang 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 Signed-off-by: Jiang Liu Cc: Yinghai Lu Cc: "Rafael J. Wysocki" Cc: Toshi Kani Cc: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/hotplug/acpiphp_glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 270fdba..7948bc9 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; iresource[i]; if ((res->flags & type_mask) && !res->start &&