drivers/sensors/gnss: Fix deactivate failure when using both topic and device

Deactivate lower driver fails when both uORB topic and driver device are subscribed and opened.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2024-12-25 12:18:44 +08:00 committed by Xiang Xiao
parent 73e55c9d3b
commit b57006e567

View file

@ -171,10 +171,11 @@ static int gnss_activate(FAR struct sensor_lowerhalf_s *lower,
if ((upper->crefs == 0 && enable) || (upper->crefs == 1 && !enable))
{
ret = upper->lower->ops->activate(upper->lower, filep, enable);
if (ret >= 0)
{
upper->crefs += enable ? 1 : -1;
}
}
if (ret >= 0)
{
upper->crefs += enable ? 1 : -1;
}
nxmutex_unlock(&upper->lock);