[PATCH 1/3] lib: utils/cache: Handle last-level cache correctly in fdt_cache_add()
Nick Hu
nick.hu at sifive.com
Thu Nov 13 19:22:45 PST 2025
The fdt_cache_add() helper attempts to retrieve the next-level cache and
returns SBI_ENOENT when there is none. Since this condition only indicates
that the current cache is the last-level cache, the helper should not
treat it as an error.
Signed-off-by: Nick Hu <nick.hu at sifive.com>
---
lib/utils/cache/fdt_cache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/utils/cache/fdt_cache.c b/lib/utils/cache/fdt_cache.c
index aeaa613830960b67bf5f512a101f0242d8692872..2a9e8a6dd53c008eec8f319d0e19c56ea1d11a1a 100644
--- a/lib/utils/cache/fdt_cache.c
+++ b/lib/utils/cache/fdt_cache.c
@@ -23,7 +23,9 @@ int fdt_cache_add(const void *fdt, int noff, struct cache_device *dev)
sbi_dprintf("%s: %s\n", __func__, dev->name);
rc = fdt_next_cache_get(fdt, noff, &dev->next);
- if (rc)
+ if (rc == SBI_ENOENT)
+ dev->next = NULL;
+ else if (rc)
return rc;
return cache_add(dev);
--
2.34.1
More information about the opensbi
mailing list