Skip to content

Commit 2691348

Browse files
etienne-lmsjforissier
authored andcommitted
treewide: remove unless void cast on unused function arguments
Function arguments that are unused are already specified using __maybe_unused attribute. Remove the useless remaining cast to void and replace __maybe_unused with __unused where applicable. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
1 parent eaf1dd7 commit 2691348

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

hello_world/ta/hello_world_ta.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ void TA_DestroyEntryPoint(void)
5757
* TA.
5858
*/
5959
TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
60-
TEE_Param __maybe_unused params[4],
61-
void __maybe_unused **sess_ctx)
60+
TEE_Param __unused params[4],
61+
void __unused **sess_ctx)
6262
{
6363
uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_NONE,
6464
TEE_PARAM_TYPE_NONE,
@@ -70,10 +70,6 @@ TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
7070
if (param_types != exp_param_types)
7171
return TEE_ERROR_BAD_PARAMETERS;
7272

73-
/* Unused parameters */
74-
(void)&params;
75-
(void)&sess_ctx;
76-
7773
/*
7874
* The DMSG() macro is non-standard, TEE Internal API doesn't
7975
* specify any means to logging from a TA.
@@ -88,9 +84,8 @@ TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
8884
* Called when a session is closed, sess_ctx hold the value that was
8985
* assigned by TA_OpenSessionEntryPoint().
9086
*/
91-
void TA_CloseSessionEntryPoint(void __maybe_unused *sess_ctx)
87+
void TA_CloseSessionEntryPoint(void __unused *sess_ctx)
9288
{
93-
(void)&sess_ctx; /* Unused parameter */
9489
IMSG("Goodbye!\n");
9590
}
9691

@@ -136,12 +131,10 @@ static TEE_Result dec_value(uint32_t param_types, TEE_Param params[4])
136131
* assigned by TA_OpenSessionEntryPoint(). The rest of the paramters
137132
* comes from normal world.
138133
*/
139-
TEE_Result TA_InvokeCommandEntryPoint(void __maybe_unused *sess_ctx,
134+
TEE_Result TA_InvokeCommandEntryPoint(void __unused *sess_ctx,
140135
uint32_t cmd_id, uint32_t param_types,
141136
TEE_Param params[4])
142137
{
143-
(void)&sess_ctx; /* Unused parameter */
144-
145138
switch (cmd_id) {
146139
case TA_HELLO_WORLD_CMD_INC_VALUE:
147140
return inc_value(param_types, params);

random/ta/random_example_ta.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ void TA_DestroyEntryPoint(void)
4040
}
4141

4242
TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
43-
TEE_Param __maybe_unused params[4],
44-
void __maybe_unused **sess_ctx)
43+
TEE_Param __unused params[4],
44+
void __unused **sess_ctx)
4545
{
4646
uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_NONE,
4747
TEE_PARAM_TYPE_NONE,
@@ -50,15 +50,11 @@ TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
5050
if (param_types != exp_param_types)
5151
return TEE_ERROR_BAD_PARAMETERS;
5252

53-
(void)&params;
54-
(void)&sess_ctx;
55-
5653
return TEE_SUCCESS;
5754
}
5855

59-
void TA_CloseSessionEntryPoint(void __maybe_unused *sess_ctx)
56+
void TA_CloseSessionEntryPoint(void __unused *sess_ctx)
6057
{
61-
(void)&sess_ctx;
6258
}
6359

6460
static TEE_Result random_number_generate(uint32_t param_types,
@@ -94,12 +90,10 @@ static TEE_Result random_number_generate(uint32_t param_types,
9490
return TEE_SUCCESS;
9591
}
9692

97-
TEE_Result TA_InvokeCommandEntryPoint(void __maybe_unused *sess_ctx,
93+
TEE_Result TA_InvokeCommandEntryPoint(void __unused *sess_ctx,
9894
uint32_t cmd_id, uint32_t param_types,
9995
TEE_Param params[4])
10096
{
101-
(void)&sess_ctx;
102-
10397
switch (cmd_id) {
10498
case TA_RANDOM_CMD_GENERATE:
10599
return random_number_generate(param_types, params);

0 commit comments

Comments
 (0)