[PATCH v5 12/16] PCI: rpaphp: kmalloc/kfree slot->name directly

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alex Chiang
Date: Wednesday, October 8, 2008 - 9:47 pm

rpaphp tends to use slot->name directly everywhere, and doesn't
ever need slot->hotplug_slot->name.

struct hotplug_slot->name is going away, so convert rpaphp directly
manipulate its own slot->name everywhere, and don't bother touching
slot->hotplug_slot->name.

Signed-off-by: Alex Chiang <achiang@hp.com>
---

 drivers/pci/hotplug/rpaphp_slot.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 736d3b4..2ea9cf1 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -43,7 +43,7 @@ static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot)
 void dealloc_slot_struct(struct slot *slot)
 {
 	kfree(slot->hotplug_slot->info);
-	kfree(slot->hotplug_slot->name);
+	kfree(slot->name);
 	kfree(slot->hotplug_slot);
 	kfree(slot);
 }
@@ -63,11 +63,9 @@ struct slot *alloc_slot_struct(struct device_node *dn,
 					   GFP_KERNEL);
 	if (!slot->hotplug_slot->info)
 		goto error_hpslot;
-	slot->hotplug_slot->name = kmalloc(strlen(drc_name) + 1, GFP_KERNEL);
-	if (!slot->hotplug_slot->name)
+	slot->name = kstrdup(drc_name, GFP_KERNEL);
+	if (!slot->name)
 		goto error_info;	
-	slot->name = slot->hotplug_slot->name;
-	strcpy(slot->name, drc_name);
 	slot->dn = dn;
 	slot->index = drc_index;
 	slot->power_domain = power_domain;

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v5 00/16] PCI: let the core manage slot names, Alex Chiang, (Wed Oct 8, 9:46 pm)
[PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Wed Oct 8, 9:46 pm)
[PATCH v5 12/16] PCI: rpaphp: kmalloc/kfree slot->name dir ..., Alex Chiang, (Wed Oct 8, 9:47 pm)
[PATCH v5 15/16] PCI: Hotplug core: remove 'name', Alex Chiang, (Wed Oct 8, 9:47 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Wed Oct 8, 10:31 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Wed Oct 8, 10:56 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Thu Oct 9, 5:32 am)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Thu Oct 9, 9:43 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Thu Oct 9, 10:27 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Fri Oct 10, 1:11 am)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Fri Oct 10, 2:29 pm)