public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz
Cc: dlsy@snoqualmie.dp.intel.com
Subject: [PATCH] PCI Hotplug: fix pciehp regression
Date: Wed, 4 May 2005 00:02:18 -0700	[thread overview]
Message-ID: <11151901381752@kroah.com> (raw)
In-Reply-To: <1115190138979@kroah.com>

[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>

---
commit b308240b49ff5a1bddc6e10513c2c83f37a0bc78
tree 7fda5a4f25632d19ae03589bee0d920efe8026c3
parent eaae4b3a84a3781543a32bcaf0a33306ae915574
author Dely Sy <dlsy@snoqualmie.dp.intel.com> 1114736933 -0700
committer Greg KH <gregkh@suse.de> 1115189116 -0700

Index: drivers/pci/hotplug/pciehp_core.c
===================================================================
--- 2d3db5e9713dd0baeba0be2577731233780f072f/drivers/pci/hotplug/pciehp_core.c  (mode:100644 sha1:72baf749e65ef812d8e7f6ed69fba0b44cfc7d58)
+++ 7fda5a4f25632d19ae03589bee0d920efe8026c3/drivers/pci/hotplug/pciehp_core.c  (mode:100644 sha1:ed1fd8d6178d7f7418d840f93db0ef6e04142c67)
@@ -90,6 +90,22 @@
   	.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,7 +155,8 @@
 
 		/* register this slot with the hotplug pci core */
 		new_slot->hotplug_slot->private = new_slot;
-		make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, 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;
 
 		new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status));
@@ -188,10 +205,6 @@
 	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;
 	}
 


  reply	other threads:[~2005-05-04  7:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-04  7:01 [GIT PATCH] PCI bugfixes for 2.6.12-rc3 Greg KH
2005-05-04  7:02 ` [PATCH] PCI: 'is_enabled' flag should be set/cleared when the device is actually enabled/disabled Greg KH
2005-05-04  7:02   ` [PATCH] PCI: fix stale PCI pm docs Greg KH
2005-05-04  7:02     ` [PATCH] PCI: update PCI documentation for pci_get_slot() depreciation Greg KH
2005-05-04  7:02       ` [PATCH] PCI: Clean up a lot of sparse "Should it be static?" warnings Greg KH
2005-05-04  7:02         ` [PATCH] PCI Hotplug ibmphp_pci.c: Fix masking out needed information too early Greg KH
2005-05-04  7:02           ` [PATCH] PCI: fix up word-aligned 16-bit PCI config access through sysfs Greg KH
2005-05-04  7:02             ` [PATCH] PCI: Add pci shutdown ability Greg KH
2005-05-04  7:02               ` [PATCH] PCI: Rapid Hance quirk Greg KH
2005-05-04  7:02                 ` Greg KH [this message]
2005-05-04  7:02                   ` [PATCH] PCI: Spelling fixes for drivers/pci Greg KH
2005-05-04  7:02                     ` [PATCH] PCI: drivers/pci/pci.c: remove pci_dac_set_dma_mask Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11151901381752@kroah.com \
    --to=gregkh@suse.de \
    --cc=dlsy@snoqualmie.dp.intel.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox