From 35aece218a1da347e7c276a18c4ccdbda32ebec9 Mon Sep 17 00:00:00 2001 From: Nick Hu Date: Fri, 14 Nov 2025 11:22:45 +0800 Subject: [PATCH] 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 Reviewed-by: Anup Patel Link: https://lore.kernel.org/r/20251114-sifive-cache-drivers-v1-1-8423a721924c@sifive.com Signed-off-by: Anup Patel --- 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 aeaa6138..2a9e8a6d 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);