summaryrefslogtreecommitdiffstats
path: root/cpukit/dtc/libfdt/fdt_rw.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-02-20 14:45:55 -0700
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-03-02 07:52:21 +0100
commit0791bdf89e3f8839623a13305d9445440cbb0482 (patch)
treefd58afc3acb4eb13b89dd8b62b69ff014e26f566 /cpukit/dtc/libfdt/fdt_rw.c
parent23fe4d7b9863ade88519a4052015f569fb2c3ac6 (diff)
downloadrtems-0791bdf89e3f8839623a13305d9445440cbb0482.tar.bz2
libfdt: Add support for disabling version checks
Allow enabling FDT_ASSUME_LATEST to disable version checks. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-7-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'cpukit/dtc/libfdt/fdt_rw.c')
-rw-r--r--cpukit/dtc/libfdt/fdt_rw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
index 4a95ce2dea..fe13671eb6 100644
--- a/cpukit/dtc/libfdt/fdt_rw.c
+++ b/cpukit/dtc/libfdt/fdt_rw.c
@@ -28,12 +28,12 @@ static int fdt_rw_probe_(void *fdt)
return 0;
FDT_RO_PROBE(fdt);
- if (fdt_version(fdt) < 17)
+ if (!can_assume(LATEST) && fdt_version(fdt) < 17)
return -FDT_ERR_BADVERSION;
if (fdt_blocks_misordered_(fdt, sizeof(struct fdt_reserve_entry),
fdt_size_dt_struct(fdt)))
return -FDT_ERR_BADLAYOUT;
- if (fdt_version(fdt) > 17)
+ if (!can_assume(LATEST) && fdt_version(fdt) > 17)
fdt_set_version(fdt, 17);
return 0;
@@ -425,7 +425,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
* sizeof(struct fdt_reserve_entry);
- if (fdt_version(fdt) >= 17) {
+ if (can_assume(LATEST) || fdt_version(fdt) >= 17) {
struct_size = fdt_size_dt_struct(fdt);
} else {
struct_size = 0;