drivers/rpmsg: fix recursive assert when call rpmsg_dump_all() in irq

Because call mutex lock is forbidden in interrupt.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang 2024-03-21 16:05:33 +08:00 committed by archer
parent 67e41d0e32
commit 1f96a0b5e9
1 changed files with 10 additions and 2 deletions

View File

@ -491,7 +491,11 @@ int rpmsg_ioctl(FAR const char *cpuname, int cmd, unsigned long arg)
FAR struct metal_list *node;
int ret = OK;
nxrmutex_lock(&g_rpmsg_lock);
if (!up_interrupt_context())
{
nxrmutex_lock(&g_rpmsg_lock);
}
metal_list_for_each(&g_rpmsg, node)
{
FAR struct rpmsg_s *rpmsg =
@ -507,7 +511,11 @@ int rpmsg_ioctl(FAR const char *cpuname, int cmd, unsigned long arg)
}
}
nxrmutex_unlock(&g_rpmsg_lock);
if (!up_interrupt_context())
{
nxrmutex_unlock(&g_rpmsg_lock);
}
return ret;
}