of/resolver: Replace kmalloc + memcpy with kmemdup()
authorStephen Boyd <stephen.boyd@linaro.org>
Fri, 13 Oct 2017 07:35:58 +0000 (00:35 -0700)
committerRob Herring <robh@kernel.org>
Mon, 16 Oct 2017 21:43:29 +0000 (16:43 -0500)
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>
drivers/of/resolver.c

index 2d58253bf2f7078c2b37d37e28ae8093d5ba7ef4..bd21a66f6930be05e0c759f818eca4fe98aa2e80 100644 (file)
@@ -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;