SPM: Improve code quality

This patch fixes the following things:
* avoid implicit casting by using matching types or casting when it is
safe.
* check the returning value of functions
* add const keyword when mutability is not required
* cast unused parameters to void to be more explicit
* add parenthesis around amcro parameters
* encapsulate function-like macros into a function to avoid name clashes

Change-Id: Ia23e859a9008be705df4424d9cc7d09e45537994
Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
diff --git a/secure_fw/spm/spm_api.h b/secure_fw/spm/spm_api.h
index 89d4564..67accd5 100644
--- a/secure_fw/spm/spm_api.h
+++ b/secure_fw/spm/spm_api.h
@@ -20,6 +20,7 @@
     SPM_ERR_PARTITION_DB_NOT_INIT,
     SPM_ERR_PARTITION_ALREADY_ACTIVE,
     SPM_ERR_PARTITION_NOT_AVAILABLE,
+    SPM_ERR_INVALID_PARAMETER,
     SPM_ERR_INVALID_CONFIG,
 };
 
@@ -297,11 +298,14 @@
  *   args[2] is out_vec
  *   args[3] is out_len
  *
+ * \return Error code \ref spm_err_t
+ *
  * \note This function doesn't check if partition_idx is valid.
  * \note This function assumes that the iovecs that are passed in args are
  *       valid, and does no sanity check on them at all.
  */
-void tfm_spm_partition_set_iovec(uint32_t partition_idx, int32_t *args);
+enum spm_err_t tfm_spm_partition_set_iovec(uint32_t partition_idx,
+                                           const int32_t *args);
 
 /**
  * \brief Initialize partition database