diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-09-05 11:55:41 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-09-13 12:07:55 +0200 |
commit | 6dd56795a1e6686bb11891777070f41e12a4545a (patch) | |
tree | b40f4f2d880aa5dbbe4f07eba7f5e43013d5580d /common | |
parent | 6553d2c2a5e3cf2f5a3e480eb959cfe2a4983421 (diff) | |
download | barebox-6dd56795a1e6686bb11891777070f41e12a4545a.tar.gz barebox-6dd56795a1e6686bb11891777070f41e12a4545a.tar.xz |
of: refactor for of_fixup_reserved_memory() for clarity
pp was never used and the ?: construct made the code needlessly terse.
Use it and make the code a bit clearer.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220905095557.596891-17-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/oftree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/oftree.c b/common/oftree.c index e459f84601..38752e2c19 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -292,8 +292,10 @@ int of_fixup_reserved_memory(struct device_node *root, void *_res) if (ret) of_property_write_u32(node, "#size-cells", size_n_cells); - pp = of_find_property(node, "ranges", &rangelen) ?: of_new_property(node, "ranges", NULL, 0); - if (rangelen) { + pp = of_find_property(node, "ranges", &rangelen); + if (!pp) { + of_new_property(node, "ranges", NULL, 0); + } else if (rangelen) { pr_warn("reserved-memory ranges not 1:1 mapped. Aborting fixup\n"); return -EINVAL; } |