[PATCH 16/32] of: refactor for of_fixup_reserved_memory() for clarity
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 5 02:55:41 PDT 2022
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 at pengutronix.de>
---
common/oftree.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/common/oftree.c b/common/oftree.c
index e459f84601a3..38752e2c191d 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;
}
--
2.30.2
More information about the barebox
mailing list