It sounds more reasonable to change the memory pointer type to const void * in tfm_memory_check().
From:
int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller, enum tfm_memory_access_e access, uint32_t privileged);
to
int32_t tfm_memory_check(const void *buffer, size_t len, int32_t ns_caller, enum tfm_memory_access_e access, uint32_t privileged);