aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/cache/fdt_cache.c
diff options
context:
space:
mode:
authorNick Hu <nick.hu@sifive.com>2025-11-14 11:22:45 +0800
committerAnup Patel <anup@brainfault.org>2025-12-08 09:51:53 +0530
commit35aece218a1da347e7c276a18c4ccdbda32ebec9 (patch)
treec6e74255f65a21d9452545628f6129f4f1553fd5 /lib/utils/cache/fdt_cache.c
parentde376252f4f3e3df4998bd14893cb687821b4102 (diff)
downloadopensbi-35aece218a1da347e7c276a18c4ccdbda32ebec9.zip
opensbi-35aece218a1da347e7c276a18c4ccdbda32ebec9.tar.gz
opensbi-35aece218a1da347e7c276a18c4ccdbda32ebec9.tar.bz2
lib: utils/cache: Handle last-level cache correctly in fdt_cache_add()
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@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20251114-sifive-cache-drivers-v1-1-8423a721924c@sifive.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib/utils/cache/fdt_cache.c')
-rw-r--r--lib/utils/cache/fdt_cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/utils/cache/fdt_cache.c b/lib/utils/cache/fdt_cache.c
index aeaa613..2a9e8a6 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);