Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf fromtree] ipc: Drain pending work items before deregistering endpoint #1486

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ static int deregister_ept(const struct device *instance, void *token)
{
struct backend_data_t *data = instance->data;
struct ipc_rpmsg_ept *rpmsg_ept;
static struct k_work_sync sync;

/* Instance is not ready */
if (atomic_get(&data->state) != STATE_INITED) {
Expand All @@ -469,6 +470,13 @@ static int deregister_ept(const struct device *instance, void *token)
return -ENOENT;
}

/* Drain pending work items before tearing down channel.
*
* Note: `k_work_flush` Faults on Cortex-M33 with "illegal use of EPSR"
* if `sync` is not declared static.
*/
k_work_flush(&data->mbox_work, &sync);

rpmsg_destroy_ept(&rpmsg_ept->ep);

memset(rpmsg_ept, 0, sizeof(struct ipc_rpmsg_ept));
Expand Down
Loading