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


The following commit(s) were added to refs/heads/master by this push:
     new 3093b28860 drivers/sensors/gnss: Fix deactivate failure when using 
both topic and device
3093b28860 is described below

commit 3093b28860dec8209d4c3a855330fa5b22e4f058
Author: wangjianyu3 <[email protected]>
AuthorDate: Wed Dec 25 12:18:44 2024 +0800

    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 <[email protected]>
---
 drivers/sensors/gnss_uorb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/sensors/gnss_uorb.c b/drivers/sensors/gnss_uorb.c
index 2353b786fc..63164a50e9 100644
--- a/drivers/sensors/gnss_uorb.c
+++ b/drivers/sensors/gnss_uorb.c
@@ -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);

Reply via email to