SPM: Optimize the PSA API error handling process
In SPM implementation, message is a struct inside connection
handle struct and therefore it is unnecessary to check whether
the message pointer is NULL.
This patch:
- Skips checking message pointer after getting it from the
connection handle.
- Returns an error code instead of calling tfm_core_panic()
in some error processing.
Change-Id: Id45e63f8bbdd3d21db3ee32b43f4553ab7520a8f
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/secure_fw/spm/ffm/backend_ipc.c b/secure_fw/spm/ffm/backend_ipc.c
index 7dc2a22..1572674 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
* Copyright (c) 2021, Cypress Semiconductor Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -53,7 +53,7 @@
struct critical_section_t cs_assert = CRITICAL_SECTION_STATIC_INIT;
if (!msg || !service || !service->p_ldinf || !service->partition) {
- tfm_core_panic();
+ return PSA_ERROR_PROGRAMMER_ERROR;
}
p_owner = service->partition;