From: Thierry Reding <tred...@nvidia.com> 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 <tred...@nvidia.com> --- lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 337c4443b032..7f6b6d523232 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1469,7 +1469,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]); -- 2.33.0