Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1342737
| From | Yinghai Lu <yinghai@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v10 19/59] PCI: Separate realloc list checking after allocation |
| Date | 2016-02-25 04:20 +0100 |
| Message-ID | <r5UD8-6ag-37@gated-at.bofh.it> (permalink) |
| References | <r5TH3-5ok-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
We check the realloc list, as list must be empty after allocation.
Separate the realloc list checking to another function.
Add checking that is missed in acpiphp driver.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
drivers/pci/hotplug/acpiphp_glue.c | 1 +
drivers/pci/pci.h | 1 +
drivers/pci/setup-bus.c | 12 +++++++++---
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index fa49f91..c35983a 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -507,6 +507,7 @@ static void enable_slot(struct acpiphp_slot *slot)
}
}
__pci_bus_assign_resources(bus, &add_list, NULL);
+ pci_bus_check_realloc(&add_list);
acpiphp_sanitize_bus(bus);
pcie_bus_configure_settings(bus);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 60d1c87..510378d 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -238,6 +238,7 @@ void __pci_bus_size_bridges(struct pci_bus *bus,
void __pci_bus_assign_resources(const struct pci_bus *bus,
struct list_head *realloc_head,
struct list_head *fail_head);
+void pci_bus_check_realloc(struct list_head *realloc_head);
bool pci_bus_clip_resource(struct pci_dev *dev, int idx);
void pci_reassigndev_resource_alignment(struct pci_dev *dev);
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index f9cd04a..4741cc9 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -280,6 +280,12 @@ out:
}
}
+void pci_bus_check_realloc(struct list_head *realloc_head)
+{
+ if (WARN_ON(!list_empty(realloc_head)))
+ free_list(realloc_head);
+}
+
/**
* assign_requested_resources_sorted() - satisfy resource requests
*
@@ -1777,7 +1783,7 @@ again:
/* Depth last, allocate resources and update the hardware. */
__pci_bus_assign_resources(bus, add_list, &fail_head);
if (add_list)
- BUG_ON(!list_empty(add_list));
+ pci_bus_check_realloc(add_list);
tried_times++;
/* any device complain? */
@@ -1852,7 +1858,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
again:
__pci_bus_size_bridges(parent, &add_list);
__pci_bridge_assign_resources(bridge, &add_list, &fail_head);
- BUG_ON(!list_empty(&add_list));
+ pci_bus_check_realloc(&add_list);
tried_times++;
if (list_empty(&fail_head))
@@ -1911,6 +1917,6 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus)
&add_list);
up_read(&pci_bus_sem);
__pci_bus_assign_resources(bus, &add_list, NULL);
- BUG_ON(!list_empty(&add_list));
+ pci_bus_check_realloc(&add_list);
}
EXPORT_SYMBOL_GPL(pci_assign_unassigned_bus_resources);
--
1.8.4.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v10 00/59] PCI: Resource allocation cleanup for v4.6 Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 16/59] PCI: Don't release fixed resource for realloc Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 12/59] PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64 Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 04/59] sparc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 14/59] PCI: Only treat non-pref mmio64 as pref if host bridge has mmio64 Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 41/59] PCI: Skip required+optional if there is no optional Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 01/59] PCI: Add pci_find_root_bus_resource() Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 07/59] PCI: Ignore BAR for ALi M1533 PCI-ISA bridge Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100 [PATCH v10 13/59] PCI: Add has_mem64 for struct host_bridge Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100 [PATCH v10 27/59] PCI: Optimize bus align/size calculation for optional during sizing Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100 [PATCH v10 33/59] PCI: Add debug printout during releasing partial assigned resources Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100 [PATCH v10 19/59] PCI: Separate realloc list checking after allocation Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100 [PATCH v10 23/59] PCI: Cleanup res_to_dev_res() printout Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100
csiph-web