diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-03-04 19:58:56 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-05 16:28:05 +0100 |
commit | c7fbc51c572e6babd7e372960472a45daf2ef7c2 (patch) | |
tree | b3bf7582d778a80be85f53cfeec894173d363f6f | |
parent | fdd7da1169dc8e9f8f2c9022926e156ae59631b6 (diff) | |
download | barebox-c7fbc51c572e.tar.gz barebox-c7fbc51c572e.tar.xz |
efi: payload: make missing state reporting less verbose
A non-existing state may not be a problem if barebox state is unused.
An error message is printed in that case inside of_read_file and failing
the initcall results in a second error message, which is annoying.
Change this to only print an info message and move along.
of_unflatten_dtb() will report errors to parse the file on its own.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240304190038.3486881-12-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | efi/payload/init.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/efi/payload/init.c b/efi/payload/init.c index 6e5ddfd22b..9afb11fd94 100644 --- a/efi/payload/init.c +++ b/efi/payload/init.c @@ -386,28 +386,31 @@ postcore_initcall(efi_postcore_init); static int efi_late_init(void) { - char *state_desc; + const char *state_desc = "/boot/EFI/barebox/state.dtb"; + struct device_node *state_root = NULL; + size_t size; + void *fdt; int ret; if (!IS_ENABLED(CONFIG_STATE)) return 0; - state_desc = xasprintf("/boot/EFI/barebox/state.dtb"); + fdt = read_file(state_desc, &size); + if (!fdt) { + pr_info("unable to read %s: %m\n", state_desc); + return 0; + } - if (state_desc) { - struct device_node *root = NULL; + state_root = of_unflatten_dtb(fdt, size); + if (!IS_ERR(state_root)) { struct device_node *np = NULL; struct state *state; - root = of_read_file(state_desc); - if (IS_ERR(root)) - return PTR_ERR(root); - - ret = barebox_register_of(root); + ret = barebox_register_of(state_root); if (ret) pr_warn("Failed to register device-tree: %pe\n", ERR_PTR(ret)); - np = of_find_node_by_alias(root, "state"); + np = of_find_node_by_alias(state_root, "state"); state = state_new_from_node(np, false); if (IS_ERR(state)) |