/* Return: 0 if all went ok, else corresponding error message  */
static int k3_sec_proxy_thread_setup(struct k3_sec_proxy_mbox *spm)
/* Return: 0 if all went ok, else corresponding error message  */
static int k3_sec_proxy_thread_setup(struct k3_sec_proxy_mbox *spm)
{
	struct k3_sec_proxy_thread *spt;
	int i, ind;
	for (i = 0; i < spm->desc->num_valid_threads; i++) {
		spt = &spm->chans[i];
		ind = spm->desc->valid_threads[i];
		spt->id = ind;
		spt->data = (void *)SEC_PROXY_THREAD(spm->target_data, ind);
		spt->scfg = (void *)SEC_PROXY_THREAD(spm->scfg, ind);
		spt->rt = (void *)SEC_PROXY_THREAD(spm->rt, ind);
		spt->rx_buf = calloc(1, spm->desc->max_msg_size);
		if (!spt->rx_buf)
			return -ENOMEM;
	}
	return 0;
}