build(ffa): change invariant CHECK to assert (3/3)

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I68ad8e57b040f7b596cc716bcdc13b82737c2946
diff --git a/src/ffa_memory.c b/src/ffa_memory.c
index 120d958..bf2fe5f 100644
--- a/src/ffa_memory.c
+++ b/src/ffa_memory.c
@@ -12,6 +12,7 @@
 #include "hf/arch/plat/ffa.h"
 
 #include "hf/api.h"
+#include "hf/assert.h"
 #include "hf/check.h"
 #include "hf/dlog.h"
 #include "hf/ffa_internal.h"
@@ -145,8 +146,8 @@
 {
 	uint64_t i;
 
-	CHECK(share_states.share_states != NULL);
-	CHECK(memory_region != NULL);
+	assert(share_states.share_states != NULL);
+	assert(memory_region != NULL);
 
 	for (i = 0; i < MAX_MEM_SHARES; ++i) {
 		if (share_states.share_states[i].share_func == 0) {
@@ -198,7 +199,7 @@
 /** Unlocks the share states lock. */
 static void share_states_unlock(struct share_states_locked *share_states)
 {
-	CHECK(share_states->share_states != NULL);
+	assert(share_states->share_states != NULL);
 	share_states->share_states = NULL;
 	sl_unlock(&share_states_lock_instance);
 }
@@ -215,8 +216,8 @@
 	struct ffa_memory_share_state *share_state;
 	uint64_t index;
 
-	CHECK(share_states.share_states != NULL);
-	CHECK(share_state_ret != NULL);
+	assert(share_states.share_states != NULL);
+	assert(share_state_ret != NULL);
 
 	/*
 	 * First look for a share_state allocated by us, in which case the
@@ -254,7 +255,7 @@
 {
 	uint32_t i;
 
-	CHECK(share_states.share_states != NULL);
+	assert(share_states.share_states != NULL);
 	share_state->share_func = 0;
 	share_state->sending_complete = false;
 	mpool_free(page_pool, share_state->memory_region);
@@ -284,7 +285,7 @@
 	uint32_t i;
 
 	/* Lock must be held. */
-	CHECK(share_states.share_states != NULL);
+	assert(share_states.share_states != NULL);
 
 	/*
 	 * Share state must already be valid, or it's not possible to get hold
@@ -321,7 +322,7 @@
 	uint32_t i;
 
 	/* Lock must be held. */
-	CHECK(share_states.share_states != NULL);
+	assert(share_states.share_states != NULL);
 
 	next_fragment_offset =
 		ffa_composite_constituent_offset(share_state->memory_region, 0);
@@ -1295,7 +1296,7 @@
 	struct ffa_value ret;
 
 	/* Lock must be held. */
-	CHECK(share_states.share_states != NULL);
+	assert(share_states.share_states != NULL);
 
 	/* Check that state is valid in sender page table and update. */
 	ret = ffa_send_check_update(
@@ -1340,13 +1341,13 @@
 	enum ffa_data_access data_access;
 	enum ffa_instruction_access instruction_access;
 
-	CHECK(permissions != NULL);
+	assert(permissions != NULL);
 
 	/*
 	 * This should already be checked by the caller, just making the
 	 * assumption clear here.
 	 */
-	CHECK(memory_region->receiver_count == 1);
+	assert(memory_region->receiver_count == 1);
 
 	/* The sender must match the message sender. */
 	if (memory_region->sender != from_locked.vm->id) {
@@ -1510,7 +1511,7 @@
 	struct ffa_memory_share_state *share_state;
 	struct ffa_memory_region *memory_region;
 
-	CHECK(share_state_ret != NULL);
+	assert(share_state_ret != NULL);
 
 	/*
 	 * Look up the share state by handle and make sure that the VM ID
diff --git a/src/manifest.c b/src/manifest.c
index 5ac2c0f..4699c20 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -9,6 +9,7 @@
 #include "hf/manifest.h"
 
 #include "hf/addr.h"
+#include "hf/assert.h"
 #include "hf/check.h"
 #include "hf/dlog.h"
 #include "hf/fdt.h"
@@ -56,7 +57,7 @@
 	char *base = str->data;
 	char *ptr = base + (VM_NAME_EXTRA_CHARS + vm_id_digits);
 
-	CHECK(vm_id_digits <= VM_ID_MAX_DIGITS);
+	assert(vm_id_digits <= VM_ID_MAX_DIGITS);
 	*(--ptr) = '\0';
 	do {
 		*(--ptr) = digits[vm_id % 10];
@@ -64,7 +65,7 @@
 	} while (vm_id);
 	*(--ptr) = 'm';
 	*(--ptr) = 'v';
-	CHECK(ptr == base);
+	assert(ptr == base);
 }
 
 /**
diff --git a/src/mm.c b/src/mm.c
index 6f15748..8075d02 100644
--- a/src/mm.c
+++ b/src/mm.c
@@ -11,6 +11,7 @@
 #include <stdatomic.h>
 #include <stdint.h>
 
+#include "hf/assert.h"
 #include "hf/check.h"
 #include "hf/dlog.h"
 #include "hf/layout.h"
@@ -470,7 +471,7 @@
 	 * Assert condition to communicate the API constraint of mm_max_level(),
 	 * that isn't encoded in the types, to the static analyzer.
 	 */
-	CHECK(root_level >= 2);
+	assert(root_level >= 2);
 
 	/* Cap end to stay within the bounds of the page table. */
 	if (end > ptable_end) {
diff --git a/src/vm.c b/src/vm.c
index 699e498..b2ab680 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -9,6 +9,7 @@
 #include "hf/vm.h"
 
 #include "hf/api.h"
+#include "hf/assert.h"
 #include "hf/check.h"
 #include "hf/cpu.h"
 #include "hf/dlog.h"
@@ -518,7 +519,7 @@
 	 * state. Count update by increments or decrements of 1 or -1,
 	 * respectively.
 	 */
-	CHECK(inc == 1 || inc == -1);
+	assert(inc == 1 || inc == -1);
 
 	sl_lock(&all_notifications_state.lock);