diff --git a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c index be77774a8eb..5a342f275ba 100644 --- a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c +++ b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c @@ -352,16 +352,11 @@ static int register_ept(const struct device *instance, void **token, struct ipc_rpmsg_instance *rpmsg_inst; struct ipc_rpmsg_ept *rpmsg_ept; - /* Instance is still being initialized */ - if (data->state == STATE_BUSY) { + /* Instance is not ready */ + if (atomic_get(&data->state) != STATE_INITED) { return -EBUSY; } - /* Instance is not initialized */ - if (data->state == STATE_READY) { - return -EINVAL; - } - /* Empty name is not valid */ if (cfg->name == NULL || cfg->name[0] == '\0') { return -EINVAL; @@ -387,16 +382,11 @@ static int send(const struct device *instance, void *token, struct backend_data_t *data = instance->data; struct ipc_rpmsg_ept *rpmsg_ept; - /* Instance is still being initialized */ - if (data->state == STATE_BUSY) { + /* Instance is not ready */ + if (atomic_get(&data->state) != STATE_INITED) { return -EBUSY; } - /* Instance is not initialized */ - if (data->state == STATE_READY) { - return -EINVAL; - } - /* Empty message is not allowed */ if (len == 0) { return -EBADMSG;