From: Alex Chiang Date: Mon, 1 Dec 2008 20:10:10 +0000 (-0700) Subject: PCI: rpaphp: kmalloc/kfree slot->name directly X-Git-Tag: v2.6.27.8~64 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0df3b637d5a8d005e88158fec2ece5438dfecf91;p=karo-tx-linux.git PCI: rpaphp: kmalloc/kfree slot->name directly commit b2132fecca02fa05d509ba4c8c1e51dee6ccd003 upstream. 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. Acked-by: Kenji Kaneshige Signed-off-by: Alex Chiang Signed-off-by: Jesse Barnes Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 30d430bc4cbb..23be8a2774c5 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;