Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b308240b authored by Dely Sy's avatar Dely Sy Committed by Greg Kroah-Hartman
Browse files

[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: default avatarDely Sy <dely.l.sy@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent eaae4b3a
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -90,6 +90,22 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = {
  	.get_cur_bus_speed =	get_cur_bus_speed,
};

/**
 * release_slot - free up the memory used by a slot
 * @hotplug_slot: slot to free
 */
static void release_slot(struct hotplug_slot *hotplug_slot)
{
	struct slot *slot = hotplug_slot->private;

	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);

	kfree(slot->hotplug_slot->info);
	kfree(slot->hotplug_slot->name);
	kfree(slot->hotplug_slot);
	kfree(slot);
}

static int init_slots(struct controller *ctrl)
{
	struct slot *new_slot;
@@ -139,6 +155,7 @@ static int init_slots(struct controller *ctrl)

		/* register this slot with the hotplug pci core */
		new_slot->hotplug_slot->private = new_slot;
		new_slot->hotplug_slot->release = &release_slot;
		make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot);
		new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops;

@@ -188,10 +205,6 @@ static int cleanup_slots (struct controller * ctrl)
	while (old_slot) {
		next_slot = old_slot->next;
		pci_hp_deregister (old_slot->hotplug_slot);
		kfree(old_slot->hotplug_slot->info);
		kfree(old_slot->hotplug_slot->name);
		kfree(old_slot->hotplug_slot);
		kfree(old_slot);
		old_slot = next_slot;
	}