[PATCH 1/2] of: base: exclude memcpy-like code from of_property_write_u8_array()

Antony Pavlov antonynpavlov at gmail.com
Mon Apr 17 03:42:09 PDT 2017


The of_new_property() function already has functionality
to copy data into of_property so we can make
of_property_write_u8_array() simpler.

Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 drivers/of/base.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 6632f4d9dd..1161ce9793 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1090,19 +1090,14 @@ int of_property_write_u8_array(struct device_node *np,
 			       size_t sz)
 {
 	struct property *prop = of_find_property(np, propname, NULL);
-	u8 *val;
 
 	if (prop)
 		of_delete_property(prop);
 
-	prop = of_new_property(np, propname, NULL, sizeof(*val) * sz);
+	prop = of_new_property(np, propname, values, sizeof(*values) * sz);
 	if (!prop)
 		return -ENOMEM;
 
-	val = prop->value;
-	while (sz--)
-		*val++ = *values++;
-
 	return 0;
 }
 
-- 
2.11.0




More information about the barebox mailing list