aboutsummaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2021-09-03 15:16:17 +0200
committerTom Warren <twarren@nvidia.com>2021-10-13 14:18:30 -0700
commitd5598cfa9bcab50812b2b416af91c2a37be67531 (patch)
treebfb954d2df5ec7d71432579beb09ac03bc17e232 /lib/fdtdec.c
parent10cd8efe1a7eacd63907ba95bd8442bc2cdce461 (diff)
downloadu-boot-d5598cfa9bcab50812b2b416af91c2a37be67531.zip
u-boot-d5598cfa9bcab50812b2b416af91c2a37be67531.tar.gz
u-boot-d5598cfa9bcab50812b2b416af91c2a37be67531.tar.bz2
fdtdec: Allow using fdtdec_get_carveout() in loops
In order make it possible to use fdtdec_get_carveout() in loops, return FDT_ERR_NOTFOUND when the passed-in index exceeds the number of phandles present in the given property. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index af92e65..f2861eb 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1431,7 +1431,7 @@ int fdtdec_get_carveout(const void *blob, const char *node, const char *name,
if (len < (sizeof(phandle) * (index + 1))) {
debug("invalid phandle index\n");
- return -FDT_ERR_BADPHANDLE;
+ return -FDT_ERR_NOTFOUND;
}
phandle = fdt32_to_cpu(prop[index]);