mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] of: base: exclude memcpy-like code from of_property_write_u8_array()
Date: Mon, 17 Apr 2017 13:42:09 +0300	[thread overview]
Message-ID: <20170417104210.8196-2-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20170417104210.8196-1-antonynpavlov@gmail.com>

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


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

  reply	other threads:[~2017-04-17 10:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17 10:42 [PATCH 0/2] of: base: some simplifications Antony Pavlov
2017-04-17 10:42 ` Antony Pavlov [this message]
2017-04-17 10:42 ` [PATCH 2/2] of: base: of_new_property(): use xstrdup() instead of strdup() Antony Pavlov
2017-04-19 10:20   ` Antony Pavlov
2017-04-19 10:19     ` Sascha Hauer
2017-04-19  9:47 ` [PATCH 0/2] of: base: some simplifications Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170417104210.8196-2-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox