mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! of: add function to read a file as unflattened device tree
Date: Fri, 19 May 2023 09:19:39 +0200	[thread overview]
Message-ID: <20230519071939.2304443-1-a.fatoum@pengutronix.de> (raw)

of: tidy up of_read_file a bit

 - change a single instance of space indentation to tabs
 - use %m instead of unwieldy strerror(errno)
 - add documentation

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/base.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 918d5e0c5348..5da188115547 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2893,6 +2893,12 @@ int of_device_disable_by_alias(const char *alias)
 	return of_device_disable(node);
 }
 
+/**
+ * of_read_file - unflatten oftree file
+ * @filename - path to file to unflatten its contents
+ *
+ * Returns the root node of the tree or an error pointer on error.
+ */
 struct device_node *of_read_file(const char *filename)
 {
 	void *fdt;
@@ -2901,8 +2907,7 @@ struct device_node *of_read_file(const char *filename)
 
 	fdt = read_file(filename, &size);
 	if (!fdt) {
-		pr_err("unable to read %s: %s\n", filename,
-			strerror(errno));
+		pr_err("unable to read %s: %m\n", filename);
 		return ERR_PTR(-errno);
 	}
 
@@ -2916,7 +2921,7 @@ struct device_node *of_read_file(const char *filename)
 out:
 	free(fdt);
 
-       return root;
+	return root;
 }
 
 /**
-- 
2.39.2




             reply	other threads:[~2023-05-19  7:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  7:19 Ahmad Fatoum [this message]
2023-05-22 11:29 ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2023-05-08  9:03 Ahmad Fatoum
2023-05-08 13:19 ` 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=20230519071939.2304443-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --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