Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: rpaphp: kmalloc/kfree slot->name directly

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 <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

authored by

Alex Chiang and committed by
Jesse Barnes
b2132fec e1acb24f

+3 -5
+3 -5
drivers/pci/hotplug/rpaphp_slot.c
··· 43 43 void dealloc_slot_struct(struct slot *slot) 44 44 { 45 45 kfree(slot->hotplug_slot->info); 46 - kfree(slot->hotplug_slot->name); 46 + kfree(slot->name); 47 47 kfree(slot->hotplug_slot); 48 48 kfree(slot); 49 49 } ··· 63 63 GFP_KERNEL); 64 64 if (!slot->hotplug_slot->info) 65 65 goto error_hpslot; 66 - slot->hotplug_slot->name = kmalloc(strlen(drc_name) + 1, GFP_KERNEL); 67 - if (!slot->hotplug_slot->name) 66 + slot->name = kstrdup(drc_name, GFP_KERNEL); 67 + if (!slot->name) 68 68 goto error_info; 69 - slot->name = slot->hotplug_slot->name; 70 - strcpy(slot->name, drc_name); 71 69 slot->dn = dn; 72 70 slot->index = drc_index; 73 71 slot->power_domain = power_domain;