aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/setup-bus.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 21212155eaba..bcf5752f6907 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -36,6 +36,16 @@ struct resource_list_x {
36 unsigned long flags; 36 unsigned long flags;
37}; 37};
38 38
39#define free_list(type, head) do { \
40 struct type *list, *tmp; \
41 for (list = (head)->next; list;) { \
42 tmp = list; \
43 list = list->next; \
44 kfree(tmp); \
45 } \
46 (head)->next = NULL; \
47} while (0)
48
39static void add_to_failed_list(struct resource_list_x *head, 49static void add_to_failed_list(struct resource_list_x *head,
40 struct pci_dev *dev, struct resource *res) 50 struct pci_dev *dev, struct resource *res)
41{ 51{
@@ -58,19 +68,6 @@ static void add_to_failed_list(struct resource_list_x *head,
58 list->next = tmp; 68 list->next = tmp;
59} 69}
60 70
61static void free_failed_list(struct resource_list_x *head)
62{
63 struct resource_list_x *list, *tmp;
64
65 for (list = head->next; list;) {
66 tmp = list;
67 list = list->next;
68 kfree(tmp);
69 }
70
71 head->next = NULL;
72}
73
74static void __dev_sort_resources(struct pci_dev *dev, 71static void __dev_sort_resources(struct pci_dev *dev,
75 struct resource_list *head) 72 struct resource_list *head)
76{ 73{
@@ -900,7 +897,7 @@ again:
900 897
901 if (tried_times >= 2) { 898 if (tried_times >= 2) {
902 /* still fail, don't need to try more */ 899 /* still fail, don't need to try more */
903 free_failed_list(&head); 900 free_list(resource_list_x, &head);
904 goto enable_all; 901 goto enable_all;
905 } 902 }
906 903
@@ -931,7 +928,7 @@ again:
931 928
932 list = list->next; 929 list = list->next;
933 } 930 }
934 free_failed_list(&head); 931 free_list(resource_list_x, &head);
935 932
936 goto again; 933 goto again;
937 934