Skip to content

Commit

Permalink
ta: change ta parameter checking example
Browse files Browse the repository at this point in the history
Change the example code for parameter checking to a way that is easier
to both read and write and that we commonly use.

Signed-off-by: Joakim Bech <[email protected]>
Reviewed-by: Etienne Carriere <[email protected]>
  • Loading branch information
jbech-linaro committed Sep 26, 2024
1 parent 12e8f23 commit 584e1c8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions building/trusted_applications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,13 @@ sequence:
TEE_Result handle_command_0(void *session, uint32_t cmd_id,
uint32_t param_types, TEE_Param params[4])
{
if ((TEE_PARAM_TYPE_GET(param_types, 0) != TEE_PARAM_TYPE_VALUE_IN) ||
(TEE_PARAM_TYPE_GET(param_types, 1) != TEE_PARAM_TYPE_VALUE_OUT) ||
(TEE_PARAM_TYPE_GET(param_types, 2) != TEE_PARAM_TYPE_MEMREF_INOUT) ||
(TEE_PARAM_TYPE_GET(param_types, 3) != TEE_PARAM_TYPE_NONE)) {
return TEE_ERROR_BAD_PARAMETERS
}
uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,
TEE_PARAM_TYPE_VALUE_OUTPUT,
TEE_PARAM_TYPE_MEMREF_INOUT,
TEE_PARAM_TYPE_NONE);
if (param_types != exp_param_types)
return TEE_ERROR_BAD_PARAMETERS;
/* process command */
...
Expand Down

0 comments on commit 584e1c8

Please sign in to comment.