SPM: Remove unused code in no connection based service
In no connection based service case:
- tfm_spm_validate_conn_handle API is not used in no connection
based service case.
- Return error directly if handle is not static
Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: I1783fc9f5bf37944e591389730ae2d3e08b8ed74
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index feee282..eb9267c 100755
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -161,6 +161,7 @@
return p_handle;
}
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
int32_t tfm_spm_validate_conn_handle(const struct conn_handle_t *conn_handle,
int32_t client_id)
{
@@ -177,6 +178,7 @@
return SPM_SUCCESS;
}
+#endif
int32_t tfm_spm_free_conn_handle(struct service_t *service,
struct conn_handle_t *conn_handle)
diff --git a/secure_fw/spm/ffm/psa_api.c b/secure_fw/spm/ffm/psa_api.c
index 62715db..810f9bd 100644
--- a/secure_fw/spm/ffm/psa_api.c
+++ b/secure_fw/spm/ffm/psa_api.c
@@ -214,6 +214,7 @@
conn_handle->rhandle = NULL;
handle = tfm_spm_to_user_handle(conn_handle);
} else {
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
conn_handle = tfm_spm_to_handle_instance(handle);
/* It is a PROGRAMMER ERROR if an invalid handle was passed. */
@@ -244,6 +245,9 @@
/* FixMe: Need to implement a mechanism to resolve this failure. */
return PSA_ERROR_PROGRAMMER_ERROR;
}
+#else
+ return PSA_ERROR_PROGRAMMER_ERROR;
+#endif
}
privileged = GET_CURRENT_PARTITION_PRIVILEGED_MODE();