aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDely Sy <dlsy@snoqualmie.dp.intel.com>2005-04-28 21:08:53 -0400
committerGreg KH <gregkh@suse.de>2005-05-04 02:45:16 -0400
commitb308240b49ff5a1bddc6e10513c2c83f37a0bc78 (patch)
tree7fda5a4f25632d19ae03589bee0d920efe8026c3 /drivers
parenteaae4b3a84a3781543a32bcaf0a33306ae915574 (diff)
[PATCH] PCI Hotplug: fix pciehp regression
I fogot to remove the code that freed the memory in cleanup_slots(). Here is the new patch, which I have also taken care of the comment by Eike to remove the cast in hotplug_slot->private. Signed-off-by: Dely Sy <dely.l.sy@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/hotplug/pciehp_core.c23
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 */
97static 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
93static int init_slots(struct controller *ctrl) 109static 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