From 760914f2585956db23e7d4196649a09e6aba9b21 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 19 May 2023 12:01:17 +0200 Subject: 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 Link: https://lore.barebox.org/20230519100120.2365970-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- 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 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) { -- cgit v1.2.3