[PATCH 1/3] lib: utils/cache: Handle last-level cache correctly in fdt_cache_add()
Anup Patel
anup at brainfault.org
Mon Dec 8 03:02:28 PST 2025
On Fri, Nov 14, 2025 at 8:46 AM Nick Hu <nick.hu at sifive.com> wrote:
>
> 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>
LGTM.
Reviewed-by: Anup Patel <anup at brainfault.org>
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
> ---
> 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
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list