summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-05-19 12:01:17 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-05-25 09:36:01 +0200
commit760914f2585956db23e7d4196649a09e6aba9b21 (patch)
treea654f16b41b46a4b4c24f81f8fd7ff138f65c4bd /commands
parent035ca2a10ef2b5776629eadb6ea97b22b7978ccb (diff)
downloadbarebox-760914f2585956db23e7d4196649a09e6aba9b21.tar.gz
barebox-760914f2585956db23e7d4196649a09e6aba9b21.tar.xz
commands: of_property: use new of_read_file
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> Link: https://lore.barebox.org/20230519100120.2365970-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/of_property.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/commands/of_property.c b/commands/of_property.c
index b507a3541e..0c914c55c6 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) {