From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 3/6] commands: of_property: use new of_read_file
Date: Fri, 19 May 2023 12:01:17 +0200 [thread overview]
Message-ID: <20230519100120.2365970-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230519100120.2365970-1-a.fatoum@pengutronix.de>
Recent addition of of_read_file also involved switching over nearly all
open coded instances to use it. of_property seems the only remaining
instance where of_read_file can be used, but isn't. Switch it over.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- new patch
---
commands/of_property.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/commands/of_property.c b/commands/of_property.c
index b507a3541e0a..0c914c55c6bf 100644
--- a/commands/of_property.c
+++ b/commands/of_property.c
@@ -305,7 +305,6 @@ static int do_of_property(int argc, char *argv[])
char *path, *propname;
char *dtbfile = NULL;
int ret = 0;
- size_t size;
struct fdt_header *fdt = NULL;
struct device_node *root = NULL;
@@ -340,15 +339,9 @@ static int do_of_property(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
if (dtbfile) {
- fdt = read_file(dtbfile, &size);
- if (!fdt) {
- printf("unable to read %s: %m\n", dtbfile);
- return -errno;
- }
-
- root = of_unflatten_dtb(fdt, size);
-
- free(fdt);
+ root = of_read_file(dtbfile);
+ if (IS_ERR(root))
+ return PTR_ERR(root);
}
if (set) {
--
2.39.2
next prev parent reply other threads:[~2023-05-19 10:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 10:01 [PATCH v2 0/6] commands: implement of_compatible command Ahmad Fatoum
2023-05-19 10:01 ` [PATCH v2 1/6] treewide: don't mix goto labels and statements on same line Ahmad Fatoum
2023-05-19 10:01 ` [PATCH v2 2/6] treewide: drop null pointer checks around of_delete_node Ahmad Fatoum
2023-05-19 10:01 ` Ahmad Fatoum [this message]
2023-05-19 10:01 ` [PATCH v2 4/6] commands: of_dump: remove duplicate error message Ahmad Fatoum
2023-05-19 10:01 ` [PATCH v2 5/6] commands: of_dump: use of_dup instead of flattening/unflattening Ahmad Fatoum
2023-05-19 10:01 ` [PATCH v2 6/6] commands: implement of_compatible command Ahmad Fatoum
2023-05-25 7:36 ` [PATCH v2 0/6] " 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=20230519100120.2365970-4-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