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>
This commit is contained in:
Nick Hu
2025-11-14 11:22:45 +08:00
committed by Anup Patel
parent de376252f4
commit 35aece218a

View File

@@ -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);