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

Save one line.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Reviewed-by: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
Stephen Boyd 2017-10-13 00:35:58 -07:00 committed by Rob Herring
parent d35d623f52
commit eeb09506c5
1 changed files with 1 additions and 2 deletions

View File

@ -84,10 +84,9 @@ static int update_usages_of_a_phandle_reference(struct device_node *overlay,
int offset, len; int offset, len;
int err = 0; int err = 0;
value = kmalloc(prop_fixup->length, GFP_KERNEL); value = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL);
if (!value) if (!value)
return -ENOMEM; return -ENOMEM;
memcpy(value, prop_fixup->value, prop_fixup->length);
/* prop_fixup contains a list of tuples of path:property_name:offset */ /* prop_fixup contains a list of tuples of path:property_name:offset */
end = value + prop_fixup->length; end = value + prop_fixup->length;