aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 924e4665bd57..b099e0025d2b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -842,9 +842,8 @@ static struct pci_cap_saved_state *pci_find_saved_cap(
842 struct pci_dev *pci_dev, char cap) 842 struct pci_dev *pci_dev, char cap)
843{ 843{
844 struct pci_cap_saved_state *tmp; 844 struct pci_cap_saved_state *tmp;
845 struct hlist_node *pos;
846 845
847 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) { 846 hlist_for_each_entry(tmp, &pci_dev->saved_cap_space, next) {
848 if (tmp->cap.cap_nr == cap) 847 if (tmp->cap.cap_nr == cap)
849 return tmp; 848 return tmp;
850 } 849 }
@@ -1041,7 +1040,6 @@ struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev)
1041 struct pci_saved_state *state; 1040 struct pci_saved_state *state;
1042 struct pci_cap_saved_state *tmp; 1041 struct pci_cap_saved_state *tmp;
1043 struct pci_cap_saved_data *cap; 1042 struct pci_cap_saved_data *cap;
1044 struct hlist_node *pos;
1045 size_t size; 1043 size_t size;
1046 1044
1047 if (!dev->state_saved) 1045 if (!dev->state_saved)
@@ -1049,7 +1047,7 @@ struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev)
1049 1047
1050 size = sizeof(*state) + sizeof(struct pci_cap_saved_data); 1048 size = sizeof(*state) + sizeof(struct pci_cap_saved_data);
1051 1049
1052 hlist_for_each_entry(tmp, pos, &dev->saved_cap_space, next) 1050 hlist_for_each_entry(tmp, &dev->saved_cap_space, next)
1053 size += sizeof(struct pci_cap_saved_data) + tmp->cap.size; 1051 size += sizeof(struct pci_cap_saved_data) + tmp->cap.size;
1054 1052
1055 state = kzalloc(size, GFP_KERNEL); 1053 state = kzalloc(size, GFP_KERNEL);
@@ -1060,7 +1058,7 @@ struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev)
1060 sizeof(state->config_space)); 1058 sizeof(state->config_space));
1061 1059
1062 cap = state->cap; 1060 cap = state->cap;
1063 hlist_for_each_entry(tmp, pos, &dev->saved_cap_space, next) { 1061 hlist_for_each_entry(tmp, &dev->saved_cap_space, next) {
1064 size_t len = sizeof(struct pci_cap_saved_data) + tmp->cap.size; 1062 size_t len = sizeof(struct pci_cap_saved_data) + tmp->cap.size;
1065 memcpy(cap, &tmp->cap, len); 1063 memcpy(cap, &tmp->cap, len);
1066 cap = (struct pci_cap_saved_data *)((u8 *)cap + len); 1064 cap = (struct pci_cap_saved_data *)((u8 *)cap + len);
@@ -2038,9 +2036,9 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev)
2038void pci_free_cap_save_buffers(struct pci_dev *dev) 2036void pci_free_cap_save_buffers(struct pci_dev *dev)
2039{ 2037{
2040 struct pci_cap_saved_state *tmp; 2038 struct pci_cap_saved_state *tmp;
2041 struct hlist_node *pos, *n; 2039 struct hlist_node *n;
2042 2040
2043 hlist_for_each_entry_safe(tmp, pos, n, &dev->saved_cap_space, next) 2041 hlist_for_each_entry_safe(tmp, n, &dev->saved_cap_space, next)
2044 kfree(tmp); 2042 kfree(tmp);
2045} 2043}
2046 2044