summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2015-10-01 12:46:08 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2015-10-05 21:11:26 +1100
commita030e1e4bbd085bbcfd0a23f8d355fcd41f39bed (patch)
tree4e02c4a9a6cfa55066206134a503f799dab9e7f9
parentdc85aaed64804205c476d06cebe4c94f66fd8a20 (diff)
powerpc/pseries: replace kmalloc + strlcpy
The helper kstrndup() will do the same in one line. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/platforms/pseries/of_helpers.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/pseries/of_helpers.c b/arch/powerpc/platforms/pseries/of_helpers.c
index 2f363e3286d1..8c6b05ae1a1d 100644
--- a/arch/powerpc/platforms/pseries/of_helpers.c
+++ b/arch/powerpc/platforms/pseries/of_helpers.c
@@ -24,10 +24,9 @@ struct device_node *pseries_of_derive_parent(const char *path)
return ERR_PTR(-EINVAL);
if (strrchr(path, '/') != path) {
- parent_path = kmalloc(parent_path_len, GFP_KERNEL);
+ parent_path = kstrndup(path, parent_path_len, GFP_KERNEL);
if (!parent_path)
return ERR_PTR(-ENOMEM);
- strlcpy(parent_path, path, parent_path_len);
}
parent = of_find_node_by_path(parent_path);
if (strcmp(parent_path, "/"))