mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: Conor Dooley <conor@kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	Samuel Holland <samuel.holland@sifive.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] cache: sifive_ccache: skip disabled device tree nodes
Date: Wed, 28 Oct 2026 15:19:40 +0200	[thread overview]
Message-ID: <20261028131939.1014720-2-thnkslprpt@gmail.com> (raw)

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@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))
+			break;
 	if (!np)
 		return -ENODEV;
 

base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
-- 
2.43.0


                 reply	other threads:[~2026-10-28 13:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261028131939.1014720-2-thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=conor@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=pjw@kernel.org \
    --cc=samuel.holland@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®