diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-05-31 09:12:36 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-02 08:37:23 +0200 |
commit | e63077f60ec743cd5535db2f5d49bbf0e9b95335 (patch) | |
tree | a1b0cef546a54d37ef8de9709b22f22ee0ca1b04 /drivers | |
parent | 0a78ac84e9fe3e91d9b01b1e128ea493c6ebc3f4 (diff) | |
download | barebox-e63077f60ec743cd5535db2f5d49bbf0e9b95335.tar.gz barebox-e63077f60ec743cd5535db2f5d49bbf0e9b95335.tar.xz |
of: propagate errors inside barebox_register_{of, fdt} into initcalls
Errors during device tree registration, while uncommon, are really
annoying, because the system may limp along and it's not clear where
the misbehavior originates from.
Failing the initcall of the device tree would improve user experience in
that error case. There is intentionally no early exit on error cases
to give barebox a chance to probe the serial driver to actually report
errors when DEBUG_LL is disabled.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210531071239.30653-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/of/base.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 6fe02649ee..b99201a50f 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1699,32 +1699,34 @@ int of_set_root_node(struct device_node *node) return 0; } -void barebox_register_of(struct device_node *root) +int barebox_register_of(struct device_node *root) { if (root_node) - return; + return -EBUSY; of_set_root_node(root); of_fix_tree(root); if (IS_ENABLED(CONFIG_OFDEVICE)) - of_probe(); + return of_probe(); + + return 0; } -void barebox_register_fdt(const void *dtb) +int barebox_register_fdt(const void *dtb) { struct device_node *root; if (root_node) - return; + return -EBUSY; root = of_unflatten_dtb(dtb); if (IS_ERR(root)) { pr_err("Cannot unflatten dtb: %pe\n", root); - return; + return PTR_ERR(root); } - barebox_register_of(root); + return barebox_register_of(root); } /** |