[PATCH] optee: device: report correct command in enumeration error message

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Jul 2 03:38:51 PDT 2026


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 at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at 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




More information about the barebox mailing list