Commit a030e1e4 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Michael Ellerman

powerpc/pseries: replace kmalloc + strlcpy

The helper kstrndup() will do the same in one line.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent dc85aaed
...@@ -24,10 +24,9 @@ struct device_node *pseries_of_derive_parent(const char *path) ...@@ -24,10 +24,9 @@ struct device_node *pseries_of_derive_parent(const char *path)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (strrchr(path, '/') != path) { if (strrchr(path, '/') != path) {
parent_path = kmalloc(parent_path_len, GFP_KERNEL); parent_path = kstrndup(path, parent_path_len, GFP_KERNEL);
if (!parent_path) if (!parent_path)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
strlcpy(parent_path, path, parent_path_len);
} }
parent = of_find_node_by_path(parent_path); parent = of_find_node_by_path(parent_path);
if (strcmp(parent_path, "/")) if (strcmp(parent_path, "/"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment