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 2024/09/28 03:40:05 UTC
(nuttx) 04/10: sensors/sensor_rpmsg.c: fix list_delete node is NULL
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/nuttx.git
commit ef9a02f51ca4a57804859da36ce50b0f4226dac3
Author: yintao <yi...@xiaomi.com>
AuthorDate: Fri Jan 12 16:19:33 2024 +0800
sensors/sensor_rpmsg.c: fix list_delete node is NULL
if remote not set CONFIG_SENSOR_RPMSG, local can't receive NS_ACK
so sensor_rpmsg_device_ns_bound won't be called, not add sre->node
when local stop remote, rpmsg_deinit_vdev will call sensor_rpmsg_ns_unbind_cb
if (ept && ept->ns_unbind_cb)
ept->ns_unbind_cb(ept);
list_delete node is NULL at sensor_rpmsg_ns_unbind_cb
Signed-off-by: yintao <yi...@xiaomi.com>
---
drivers/sensors/sensor_rpmsg.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/sensors/sensor_rpmsg.c b/drivers/sensors/sensor_rpmsg.c
index 2fb359b3d5..b67c211318 100644
--- a/drivers/sensors/sensor_rpmsg.c
+++ b/drivers/sensors/sensor_rpmsg.c
@@ -1303,7 +1303,11 @@ static void sensor_rpmsg_ns_unbind_cb(FAR struct rpmsg_endpoint *ept)
nxrmutex_unlock(&g_dev_lock);
nxrmutex_lock(&g_ept_lock);
- list_delete(&sre->node);
+ if (list_in_list(&sre->node))
+ {
+ list_delete(&sre->node);
+ }
+
nxrmutex_unlock(&g_ept_lock);
nxrmutex_destroy(&sre->lock);