aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/dlpar.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries/dlpar.c')
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index e1682bc168a3..d71e58584086 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -79,13 +79,12 @@ static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa)
79 * prepend this to the full_name. 79 * prepend this to the full_name.
80 */ 80 */
81 name = (char *)ccwa + ccwa->name_offset; 81 name = (char *)ccwa + ccwa->name_offset;
82 dn->full_name = kmalloc(strlen(name) + 2, GFP_KERNEL); 82 dn->full_name = kasprintf(GFP_KERNEL, "/%s", name);
83 if (!dn->full_name) { 83 if (!dn->full_name) {
84 kfree(dn); 84 kfree(dn);
85 return NULL; 85 return NULL;
86 } 86 }
87 87
88 sprintf(dn->full_name, "/%s", name);
89 return dn; 88 return dn;
90} 89}
91 90
@@ -410,15 +409,13 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
410 * directory of the device tree. CPUs actually live in the 409 * directory of the device tree. CPUs actually live in the
411 * cpus directory so we need to fixup the full_name. 410 * cpus directory so we need to fixup the full_name.
412 */ 411 */
413 cpu_name = kzalloc(strlen(dn->full_name) + strlen("/cpus") + 1, 412 cpu_name = kasprintf(GFP_KERNEL, "/cpus%s", dn->full_name);
414 GFP_KERNEL);
415 if (!cpu_name) { 413 if (!cpu_name) {
416 dlpar_free_cc_nodes(dn); 414 dlpar_free_cc_nodes(dn);
417 rc = -ENOMEM; 415 rc = -ENOMEM;
418 goto out; 416 goto out;
419 } 417 }
420 418
421 sprintf(cpu_name, "/cpus%s", dn->full_name);
422 kfree(dn->full_name); 419 kfree(dn->full_name);
423 dn->full_name = cpu_name; 420 dn->full_name = cpu_name;
424 421
@@ -433,6 +430,7 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
433 if (rc) { 430 if (rc) {
434 dlpar_release_drc(drc_index); 431 dlpar_release_drc(drc_index);
435 dlpar_free_cc_nodes(dn); 432 dlpar_free_cc_nodes(dn);
433 goto out;
436 } 434 }
437 435
438 rc = dlpar_online_cpu(dn); 436 rc = dlpar_online_cpu(dn);