aboutsummaryrefslogtreecommitdiffstats
path: root/fdt_addresses.c
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2019-05-24 02:10:16 +0000
committerKyle Evans <kevans@FreeBSD.org>2019-05-24 02:10:16 +0000
commit82706df85234185453be8156e6269787fbfa8aff (patch)
tree9f30867784ff4b059cb38a6ea78716d2e0775165 /fdt_addresses.c
parentaa7bcf5ec65a3f4d0c68e4a08b736f1face35c60 (diff)
downloadsrc-vendor/libfdt.tar.gz
src-vendor/libfdt.zip
Import libfdt from dtc 1.5.0vendor/libfdt/1.5.0vendor/libfdt
Notes
Notes: svn path=/vendor-sys/libfdt/dist/; revision=348220 svn path=/vendor-sys/libfdt/1.5.0/; revision=348221; tag=vendor/libfdt/1.5.0
Diffstat (limited to 'fdt_addresses.c')
-rw-r--r--fdt_addresses.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/fdt_addresses.c b/fdt_addresses.c
index 49537b578d03..f13a87dfa068 100644
--- a/fdt_addresses.c
+++ b/fdt_addresses.c
@@ -64,7 +64,7 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name)
c = fdt_getprop(fdt, nodeoffset, name, &len);
if (!c)
- return 2;
+ return len;
if (len != sizeof(*c))
return -FDT_ERR_BADNCELLS;
@@ -78,10 +78,20 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name)
int fdt_address_cells(const void *fdt, int nodeoffset)
{
- return fdt_cells(fdt, nodeoffset, "#address-cells");
+ int val;
+
+ val = fdt_cells(fdt, nodeoffset, "#address-cells");
+ if (val == -FDT_ERR_NOTFOUND)
+ return 2;
+ return val;
}
int fdt_size_cells(const void *fdt, int nodeoffset)
{
- return fdt_cells(fdt, nodeoffset, "#size-cells");
+ int val;
+
+ val = fdt_cells(fdt, nodeoffset, "#size-cells");
+ if (val == -FDT_ERR_NOTFOUND)
+ return 1;
+ return val;
}