Fix some driver return values. If sem_wait fails, the errcode is in errno, not the return value.
This commit is contained in:
parent
a626ba5b70
commit
c51b642f81
@ -455,8 +455,9 @@ static ssize_t bmg160_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
ret = sem_wait(&priv->datasem);
|
ret = sem_wait(&priv->datasem);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
int errcode = errno;
|
||||||
return ret;
|
snerr("ERROR: Could not aquire priv->datasem: %d\n", errcode);
|
||||||
|
return -errcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the sensor data into the buffer */
|
/* Copy the sensor data into the buffer */
|
||||||
|
@ -451,8 +451,9 @@ static ssize_t lis3dsh_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
ret = sem_wait(&priv->datasem);
|
ret = sem_wait(&priv->datasem);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
int errcode = errno;
|
||||||
return ret;
|
snerr("ERROR: Could not aquire priv->datasem: %d\n", errcode);
|
||||||
|
return -errcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the sensor data into the buffer */
|
/* Copy the sensor data into the buffer */
|
||||||
|
@ -494,8 +494,9 @@ static ssize_t lis3mdl_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
ret = sem_wait(&priv->datasem);
|
ret = sem_wait(&priv->datasem);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
int errcode = errno;
|
||||||
return ret;
|
snerr("ERROR: Could not aquire priv->datasem: %d\n", errcode);
|
||||||
|
return -errcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the sensor data into the buffer */
|
/* Copy the sensor data into the buffer */
|
||||||
|
@ -486,8 +486,9 @@ static ssize_t mlx90393_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
ret = sem_wait(&priv->datasem);
|
ret = sem_wait(&priv->datasem);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("ERROR: Could not aquire priv->datasem: %d\n", ret);
|
int errcode = errno;
|
||||||
return ret;
|
snerr("ERROR: Could not aquire priv->datasem: %d\n", errcode);
|
||||||
|
return -errcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = (FAR struct mlx90393_sensor_data_s *)buffer;
|
data = (FAR struct mlx90393_sensor_data_s *)buffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user