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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux