From ef9a02f51ca4a57804859da36ce50b0f4226dac3 Mon Sep 17 00:00:00 2001 From: yintao Date: Fri, 12 Jan 2024 16:19:33 +0800 Subject: [PATCH] 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 --- 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 2fb359b3d56..b67c2113185 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);