From patchwork Tue Feb 26 15:25:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2186081 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C26ED3FCF2 for ; Tue, 26 Feb 2013 15:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759614Ab3BZPas (ORCPT ); Tue, 26 Feb 2013 10:30:48 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:44938 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759620Ab3BZPaq (ORCPT ); Tue, 26 Feb 2013 10:30:46 -0500 Received: by mail-pa0-f53.google.com with SMTP id bg4so2491414pad.26 for ; Tue, 26 Feb 2013 07:30:46 -0800 (PST) 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=iS3yxDW5pEDD/QdgtQnruNsB80SfTRhcoLwgMYUs4fc=; b=SK8a74Vm7mjwR+Q0zvRiQTV2RErCDIqOj4l+NAwr08ZQd1HW2CG7kP9eLovioEozjy FnnsIznP0i549mD/KN5TOWUIEM478bCt/4K+PGt8gmmT9DAOUWQ0Z+Eocff0XvGC7d7Y x+43DVe6tDHfp67QdGd0GlNn1c0MTPUJ8w2O50dBJBe5687AvwDY0S0hob47RqnxgT/d flsVaDfntdh0UzUdY4n7CL2w0lJawevyb1Kh3GEPLXL24IUSpkvdPMa7D97RSdcZ+q6N 4+msl+Ejq39JdYbEqtgrA3LO13jjXw+xkgThrSMUVznaQAxCbIZ8HXYG08CjdbQbGhJa d69w== X-Received: by 10.68.138.225 with SMTP id qt1mr23806744pbb.82.1361892645997; Tue, 26 Feb 2013 07:30:45 -0800 (PST) Received: from localhost.localdomain ([114.250.77.63]) by mx.google.com with ESMTPS id gg7sm1229055pbc.45.2013.02.26.07.30.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Feb 2013 07:30:44 -0800 (PST) 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 v8 02/13] PCI/acpiphp: use list_for_each_entry_safe() in acpiphp_sanitize_bus() Date: Tue, 26 Feb 2013 23:25:42 +0800 Message-Id: <1361892353-14786-3-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361892353-14786-1-git-send-email-jiang.liu@huawei.com> References: <1361892353-14786-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 4681d2c..514851d8 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -1086,11 +1086,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 &&