[PATCH] cache: sifive_ccache: skip disabled device tree nodes
Conor Dooley
conor at kernel.org
Thu Nov 5 10:24:25 PST 2026
On Wed, Oct 28, 2026 at 03:19:40PM +0200, Avi Weiss wrote:
> sifive_ccache_init() uses of_find_matching_node_and_match(), which also
> returns nodes marked as disabled. The initializer can therefore map and
> access a cache controller that the device tree marks unavailable.
>
> Select the first available matching node before accessing its registers.
> This also handles a disabled node preceding an enabled one.
>
> Fixes: a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
> Signed-off-by: Avi Weiss <thnkslprpt at gmail.com>
> ---
> drivers/cache/sifive_ccache.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cache/sifive_ccache.c b/drivers/cache/sifive_ccache.c
> index 71d3f94987fa..02878d54381d 100644
> --- a/drivers/cache/sifive_ccache.c
> +++ b/drivers/cache/sifive_ccache.c
> @@ -297,7 +297,9 @@ static int __init sifive_ccache_init(void)
> unsigned long quirks __maybe_unused;
> int rc;
>
> - np = of_find_matching_node_and_match(NULL, sifive_ccache_ids, &match);
> + for_each_matching_node_and_match(np, sifive_ccache_ids, &match)
> + if (of_device_is_available(np))
Are there any devices where this is actually possible? IOW, where there
are 2 ccache instances.
> + break;
> if (!np)
> return -ENODEV;
>
>
> base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
> --
> 2.43.0
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20261105/4b28e8fb/attachment.sig>
More information about the linux-riscv
mailing list