Interface: Improve code quality
This patch fixes implicit casting in the tfm_ns_lock_dispatch function.
Change-Id: I9f3db6e850f22c608c26b45a481cb3c910d2abd6
Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
diff --git a/interface/include/tfm_ns_lock.h b/interface/include/tfm_ns_lock.h
index f9a47f0..ff38556 100644
--- a/interface/include/tfm_ns_lock.h
+++ b/interface/include/tfm_ns_lock.h
@@ -23,9 +23,9 @@
* \details To be called from the wrapper API interface
*/
-uint32_t tfm_ns_lock_dispatch(veneer_fn fn,
- uint32_t arg0, uint32_t arg1,
- uint32_t arg2, uint32_t arg3);
+int32_t tfm_ns_lock_dispatch(veneer_fn fn,
+ uint32_t arg0, uint32_t arg1,
+ uint32_t arg2, uint32_t arg3);
/**
* \brief NS world, Init NS lock
diff --git a/interface/src/tfm_ns_lock_cmsis_rtos.c b/interface/src/tfm_ns_lock_cmsis_rtos.c
index a81f6e1..3747319 100644
--- a/interface/src/tfm_ns_lock_cmsis_rtos.c
+++ b/interface/src/tfm_ns_lock_cmsis_rtos.c
@@ -38,26 +38,26 @@
/**
* \brief NS world, NS lock based dispatcher
*/
-uint32_t tfm_ns_lock_dispatch(veneer_fn fn,
- uint32_t arg0, uint32_t arg1,
- uint32_t arg2, uint32_t arg3)
+int32_t tfm_ns_lock_dispatch(veneer_fn fn,
+ uint32_t arg0, uint32_t arg1,
+ uint32_t arg2, uint32_t arg3)
{
- uint32_t result;
+ int32_t result;
/* Check the NS lock has been initialized */
if (ns_lock.init == false) {
- return TFM_ERROR_GENERIC;
+ return (int32_t)TFM_ERROR_GENERIC;
}
/* TFM request protected by NS lock */
if (osMutexAcquire(ns_lock.id, osWaitForever) != osOK) {
- return TFM_ERROR_GENERIC;
+ return (int32_t)TFM_ERROR_GENERIC;
}
result = fn(arg0, arg1, arg2, arg3);
if (osMutexRelease(ns_lock.id) != osOK) {
- return TFM_ERROR_GENERIC;
+ return (int32_t)TFM_ERROR_GENERIC;
}
return result;