You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/11/11 12:04:41 UTC
[incubator-nuttx] 01/02: rptun: fix rptun sem post too much
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit f599527e1e6de92e24313c554fc33a912440fb47
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Nov 4 11:44:25 2022 +0800
rptun: fix rptun sem post too much
_assert
/media/liangchaozhong/ssd/86v1ap/nuttx/libs/libc/assert/lib_assert.c:36
nxsem_post
/media/liangchaozhong/ssd/86v1ap/nuttx/sched/semaphore/sem_post.c:91 (discriminator 1)
rptun_wakeup_rx
/media/liangchaozhong/ssd/86v1ap/nuttx/drivers/rptun/rptun.c:374
rpmsg_virtio_rx_callback
/media/liangchaozhong/ssd/86v1ap/nuttx/openamp/open-amp/lib/rpmsg/rpmsg_virtio.c:377
rproc_virtio_notified
/media/liangchaozhong/ssd/86v1ap/nuttx/openamp/open-amp/lib/remoteproc/remoteproc_virtio.c:342
remoteproc_get_notification
/media/liangchaozhong/ssd/86v1ap/nuttx/openamp/open-amp/lib/remoteproc/remoteproc.c:998
nxtask_start
/media/liangchaozhong/ssd/86v1ap/nuttx/sched/task/task_start.c:129
Signed-off-by: ligd <li...@xiaomi.com>
---
drivers/rptun/rptun.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c
index 5c5208c6e2..8cdbc92109 100644
--- a/drivers/rptun/rptun.c
+++ b/drivers/rptun/rptun.c
@@ -292,7 +292,13 @@ static int rptun_thread(int argc, FAR char *argv[])
static void rptun_wakeup_rx(FAR struct rptun_priv_s *priv)
{
- nxsem_post(&priv->semrx);
+ int semcount;
+
+ nxsem_get_value(&priv->semrx, &semcount);
+ if (semcount < 1)
+ {
+ nxsem_post(&priv->semrx);
+ }
}
static bool rptun_is_recursive(FAR struct rptun_priv_s *priv)