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 c0f7dd979e
commit 3093b28860

View file

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