mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] optee: device: report correct command in enumeration error message
Date: Thu,  2 Jul 2026 12:38:51 +0200	[thread overview]
Message-ID: <20260702103851.2391715-1-a.fatoum@pengutronix.de> (raw)

While enumeration failure always mentions "PTA_CMD_GET_DEVICES", it is
possible that either PTA_CMD_GET_DEVICES_SUPP or PTA_CMD_GET_DEVICES_RPMB
were the culprits.

Remove the hardcoded PTA_CMD_GET_DEVICES in the error message as it's no
longer accurate and replace it by the actual command being sent.

Fixes: c840a27cfaa4 ("tee: optee: use RPMB probe capability to select enumeration path")
Reported-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/tee/optee/device.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
index 2713af0797e1..425971b9544e 100644
--- a/drivers/tee/optee/device.c
+++ b/drivers/tee/optee/device.c
@@ -21,6 +21,20 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
 		return 0;
 }
 
+static const char *pta_cmd_str(u32 func)
+{
+	switch (func) {
+	case PTA_CMD_GET_DEVICES:
+		return "PTA_CMD_GET_DEVICES";
+	case PTA_CMD_GET_DEVICES_SUPP:
+		return "PTA_CMD_GET_DEVICES_SUPP";
+	case PTA_CMD_GET_DEVICES_RPMB:
+		return "PTA_CMD_GET_DEVICES_RPMB";
+	default:
+		return "PTA command";
+	}
+}
+
 static int get_devices(struct tee_context *ctx, u32 session,
 		       struct tee_shm *device_shm, u32 *shm_size,
 		       u32 func)
@@ -45,8 +59,8 @@ static int get_devices(struct tee_context *ctx, u32 session,
 	ret = tee_client_invoke_func(ctx, &inv_arg, param);
 	if ((ret < 0) || ((inv_arg.ret != TEEC_SUCCESS) &&
 			  (inv_arg.ret != TEEC_ERROR_SHORT_BUFFER))) {
-		pr_err("PTA_CMD_GET_DEVICES invoke function err: %x\n",
-		       inv_arg.ret);
+		pr_err("%s invoke function err: %x\n",
+		       pta_cmd_str(func), inv_arg.ret);
 		return -EINVAL;
 	}
 
-- 
2.47.3




             reply	other threads:[~2026-07-02 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 10:38 Ahmad Fatoum [this message]
2026-07-07  6:52 ` 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=20260702103851.2391715-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --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