/* Find endpoint that was registered with name that matches name contained in the endpoint bound message received from remote. */
static int find_ept_by_name(struct backend_data *dev_data, const char *name)
/* Find endpoint that was registered with name that matches name contained in the endpoint bound message received from remote. */
static int find_ept_by_name(struct backend_data *dev_data, const char *name)
{
	const struct channel_config *rx_conf = &dev_data->conf->rx;
	const char *buffer_end = (const char *)rx_conf->blocks_ptr +
				 rx_conf->block_count * rx_conf->block_size;
	struct ept_data *ept;
	size_t name_size;
	size_t i;
	name_size = strnlen(name, buffer_end - name - 1) + 1;
	for (i = 0; i < NUM_EPT; i++) {
		ept = &dev_data->ept[i];
		if (atomic_get(&ept->state) == EPT_CONFIGURED &&
		    strncmp(ept->cfg->name, name, name_size) == 0) {
			return i;
		}
	}
	return -ENOENT;
}