mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 2/2] tee: optee: skip optee node fixup if method is NULL
Date: Wed,  6 Aug 2025 14:52:29 +0200	[thread overview]
Message-ID: <20250806125229.2804284-2-a.fatoum@barebox.org> (raw)
In-Reply-To: <20250806125229.2804284-1-a.fatoum@barebox.org>

The function fixes up an OP-TEE node as well as reserved memory regions.
It can be useful to fix up the memory reservations, but not the OP-TEE
node itself, so let's make this possible if the method is NULL.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/tee/optee/of_fixup.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/tee/optee/of_fixup.c b/drivers/tee/optee/of_fixup.c
index 5a3eb094f22d..152322901a7e 100644
--- a/drivers/tee/optee/of_fixup.c
+++ b/drivers/tee/optee/of_fixup.c
@@ -10,24 +10,27 @@ int of_optee_fixup(struct device_node *root, void *_data)
 	struct of_optee_fixup_data *fixup_data = _data;
 	const char *optee_of_path = "/firmware/optee";
 	struct resource res_core = {}, res_shm = {};
-	struct device_node *node;
 	u64 optee_membase;
 	int ret;
 
 	if (of_find_node_by_path_from(root, optee_of_path))
 		return 0;
 
-	node = of_create_node(root, optee_of_path);
-	if (!node)
-		return -ENOMEM;
+	if (fixup_data->method) {
+		struct device_node *node;
 
-	ret = of_property_write_string(node, "compatible", "linaro,optee-tz");
-	if (ret)
-		return ret;
+		node = of_create_node(root, optee_of_path);
+		if (!node)
+			return -ENOMEM;
 
-	ret = of_property_write_string(node, "method", fixup_data->method);
-	if (ret)
-		return ret;
+		ret = of_property_write_string(node, "compatible", "linaro,optee-tz");
+		if (ret)
+			return ret;
+
+		ret = of_property_write_string(node, "method", fixup_data->method);
+		if (ret)
+			return ret;
+	}
 
 	if (!optee_get_membase(&optee_membase)) {
 		res_core.start = optee_membase;
-- 
2.39.5




  reply	other threads:[~2025-08-06 12:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-06 12:52 [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h Ahmad Fatoum
2025-08-06 12:52 ` Ahmad Fatoum [this message]
2025-08-07  6:11 ` Sascha Hauer

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=20250806125229.2804284-2-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /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