mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: do not acccess 'prop->value' directly
@ 2024-04-12 16:29 Enrico Scholz
  2024-04-16 11:16 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Enrico Scholz @ 2024-04-12 16:29 UTC (permalink / raw)
  To: barebox; +Cc: Enrico Scholz

From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>

Use of_property_get_value() accessor.  Else, wrong results are
returned when working with fit images.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 drivers/of/base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b22959dabebf..9bd0cdaac2ad 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -853,7 +853,7 @@ int of_property_count_elems_of_size(const struct device_node *np,
 
 	if (!prop)
 		return -EINVAL;
-	if (!prop->value)
+	if (!of_property_get_value(prop))
 		return -ENODATA;
 
 	if (prop->length % elem_size != 0) {
@@ -2009,9 +2009,9 @@ int of_property_read_string_helper(const struct device_node *np,
 
 	if (!prop)
 		return -EINVAL;
-	if (!prop->value)
+	p = of_property_get_value(prop);
+	if (!p)
 		return -ENODATA;
-	p = prop->value;
 	end = p + prop->length;
 
 	for (i = 0; p < end && (!out_strs || i < skip + sz); i++, p += l) {
-- 
2.44.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] of: do not acccess 'prop->value' directly
  2024-04-12 16:29 [PATCH] of: do not acccess 'prop->value' directly Enrico Scholz
@ 2024-04-16 11:16 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-04-16 11:16 UTC (permalink / raw)
  To: barebox, Enrico Scholz


On Fri, 12 Apr 2024 18:29:25 +0200, Enrico Scholz wrote:
> Use of_property_get_value() accessor.  Else, wrong results are
> returned when working with fit images.
> 
> 

Applied, thanks!

[1/1] of: do not acccess 'prop->value' directly
      https://git.pengutronix.de/cgit/barebox/commit/?id=7b7ab4a37d25 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-16 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 16:29 [PATCH] of: do not acccess 'prop->value' directly Enrico Scholz
2024-04-16 11:16 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox