diff mbox series

[2/2] of/resolver: Replace kmalloc + memcpy with kmemdup()

Message ID 20171013073558.11518-3-stephen.boyd@linaro.org
State Accepted
Commit eeb09506c58a326e1c571b7f9ee30b7fdbc6239d
Headers show
Series [1/2] of/resolver: Simplify to be32_add_cpu() | expand

Commit Message

Stephen Boyd Oct. 13, 2017, 7:35 a.m. UTC
Save one line.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>

---
 drivers/of/resolver.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.14.GIT
diff mbox series

Patch

diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 2d58253bf2f7..bd21a66f6930 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -84,10 +84,9 @@  static int update_usages_of_a_phandle_reference(struct device_node *overlay,
 	int offset, len;
 	int err = 0;
 
-	value = kmalloc(prop_fixup->length, GFP_KERNEL);
+	value = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL);
 	if (!value)
 		return -ENOMEM;
-	memcpy(value, prop_fixup->value, prop_fixup->length);
 
 	/* prop_fixup contains a list of tuples of path:property_name:offset */
 	end = value + prop_fixup->length;