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.golin@gmail.com>
This commit is contained in:
Matteo Golin 2025-07-24 15:33:27 -04:00 committed by Xiang Xiao
parent b78b870d68
commit da72df9ab6

View file

@ -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 */