This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 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 703ce05c27e drivers/sensors: unlock on direct read buffer error
703ce05c27e is described below
commit 703ce05c27e35bd191164fd6678da1073ce6aa9c
Author: chao an <[email protected]>
AuthorDate: Wed Oct 21 13:48:35 2026 +0800
drivers/sensors: unlock on direct read buffer error
sensor_read() takes the upper-half lock before handling the direct fetch
path. If direct fetch is supported and the caller passes a NULL buffer,
the old error path returned -EINVAL immediately while still holding the
lock.
Route the NULL buffer error through the common unlock path so the sensor
upper-half lock is always released before returning.
Signed-off-by: chao an <[email protected]>
---
drivers/sensors/sensor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c
index 9c1657f6bdc..d9dc854b48b 100644
--- a/drivers/sensors/sensor.c
+++ b/drivers/sensors/sensor.c
@@ -901,7 +901,8 @@ static ssize_t sensor_read(FAR struct file *filep, FAR char
*buffer,
{
if (buffer == NULL)
{
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
/* Read the device directly, there is nothing to wait for */