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 da72df9ab6 drivers/sensors/l86xxx: Fix kernel crashes on failed 
registration
da72df9ab6 is described below

commit da72df9ab6872a02a8cbb66ffc342c16cf4d881c
Author: Matteo Golin <matteo.go...@gmail.com>
AuthorDate: Thu Jul 24 15:33:27 2025 -0400

    drivers/sensors/l86xxx: Fix kernel crashes on failed registration
    
    Sometimes this driver will boot when the serial port is of the wrong
    baud rate, and it cannot set the correct baud rate or verify
    communication. This commit prevents registration if any settings fail to
    be set, and also prevents the kernel thread from setting the L86 to
    enabled (this is done only by the uORB upper half).
    
    Signed-off-by: Matteo Golin <matteo.go...@gmail.com>
---
 drivers/sensors/l86xxx_uorb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/sensors/l86xxx_uorb.c b/drivers/sensors/l86xxx_uorb.c
index be8ad4521f..e07d19758a 100644
--- a/drivers/sensors/l86xxx_uorb.c
+++ b/drivers/sensors/l86xxx_uorb.c
@@ -548,7 +548,6 @@ static int l86xxx_thread(int argc, FAR char *argv[])
       (FAR l86xxx_dev_s *)((uintptr_t)strtoul(argv[1], NULL, 16));
   struct sensor_gnss gps;
   memset(&gps, 0, sizeof(gps));
-  dev->enabled = true;
   int err;
   int bw;
 
@@ -792,6 +791,7 @@ int l86xxx_register(FAR const char *uartpath, int devno)
   if (err < 0)
     {
       snwarn("Couldn't set baud rate of device: %d\n", err);
+      goto close_file;
     }
   #endif
 
@@ -799,6 +799,7 @@ int l86xxx_register(FAR const char *uartpath, int devno)
   if (err < 0)
     {
       snwarn("Couldn't set position fix interval, %d\n", err);
+      goto close_file;
     }
 
   /* Register UORB Sensor */

Reply via email to