diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c index c170189bbfe..d23c83b54a6 100644 --- a/drivers/sensors/sensor.c +++ b/drivers/sensors/sensor.c @@ -1017,13 +1017,10 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case SNIOC_FLUSH: { - nxrmutex_lock(&upper->lock); - /* If the sensor is not activated, return -EINVAL. */ if (upper->state.nsubscribers == 0) { - nxrmutex_unlock(&upper->lock); return -EINVAL; } @@ -1061,8 +1058,6 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg) ret = 0; } } - - nxrmutex_unlock(&upper->lock); } break;