diff options
| -rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 72baf749e65e..ed1fd8d6178d 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
| @@ -90,6 +90,22 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = { | |||
| 90 | .get_cur_bus_speed = get_cur_bus_speed, | 90 | .get_cur_bus_speed = get_cur_bus_speed, |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | /** | ||
| 94 | * release_slot - free up the memory used by a slot | ||
| 95 | * @hotplug_slot: slot to free | ||
| 96 | */ | ||
| 97 | static void release_slot(struct hotplug_slot *hotplug_slot) | ||
| 98 | { | ||
| 99 | struct slot *slot = hotplug_slot->private; | ||
| 100 | |||
| 101 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | ||
| 102 | |||
| 103 | kfree(slot->hotplug_slot->info); | ||
| 104 | kfree(slot->hotplug_slot->name); | ||
| 105 | kfree(slot->hotplug_slot); | ||
| 106 | kfree(slot); | ||
| 107 | } | ||
| 108 | |||
| 93 | static int init_slots(struct controller *ctrl) | 109 | static int init_slots(struct controller *ctrl) |
| 94 | { | 110 | { |
| 95 | struct slot *new_slot; | 111 | struct slot *new_slot; |
| @@ -139,7 +155,8 @@ static int init_slots(struct controller *ctrl) | |||
| 139 | 155 | ||
| 140 | /* register this slot with the hotplug pci core */ | 156 | /* register this slot with the hotplug pci core */ |
| 141 | new_slot->hotplug_slot->private = new_slot; | 157 | new_slot->hotplug_slot->private = new_slot; |
| 142 | make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); | 158 | new_slot->hotplug_slot->release = &release_slot; |
| 159 | make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); | ||
| 143 | new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; | 160 | new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; |
| 144 | 161 | ||
| 145 | new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); | 162 | new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); |
| @@ -188,10 +205,6 @@ static int cleanup_slots (struct controller * ctrl) | |||
| 188 | while (old_slot) { | 205 | while (old_slot) { |
| 189 | next_slot = old_slot->next; | 206 | next_slot = old_slot->next; |
| 190 | pci_hp_deregister (old_slot->hotplug_slot); | 207 | pci_hp_deregister (old_slot->hotplug_slot); |
| 191 | kfree(old_slot->hotplug_slot->info); | ||
| 192 | kfree(old_slot->hotplug_slot->name); | ||
| 193 | kfree(old_slot->hotplug_slot); | ||
| 194 | kfree(old_slot); | ||
| 195 | old_slot = next_slot; | 208 | old_slot = next_slot; |
| 196 | } | 209 | } |
| 197 | 210 | ||
