]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/rpaphp_slot.c
PCI: rpaphp: kmalloc/kfree slot->name directly
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / rpaphp_slot.c
index 736d3b43ed0b312ec8088a58ff5438e433f8bd7b..2ea9cf1a8d02ec2fa2785f9493610f392a6b7be4 100644 (file)
@@ -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;