drivers/sensors/scd30: Fix invalid parameter check
Fix invalid parameter check and redundant conditions.
This commit is contained in:
parent
bf332cf888
commit
3787a362bf
@ -835,7 +835,7 @@ static int scd30_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_SET_INTERVAL:
|
||||
{
|
||||
if (arg < 2 && arg > 1800)
|
||||
if (arg < 2 || arg > 1800)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
@ -851,7 +851,7 @@ static int scd30_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_SET_TEMP_OFFSET:
|
||||
{
|
||||
if (arg < 0 && arg > UINT16_MAX)
|
||||
if (arg > UINT16_MAX)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
@ -867,7 +867,7 @@ static int scd30_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_SET_PRESSURE_COMP:
|
||||
{
|
||||
if (arg != 0 && arg < 700 && arg > 1200)
|
||||
if (arg != 0 && (arg < 700 || arg > 1200))
|
||||
{
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
@ -891,7 +891,7 @@ static int scd30_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_SET_ALTITUDE_COMP:
|
||||
{
|
||||
if (arg < 0 && arg > UINT16_MAX)
|
||||
if (arg > UINT16_MAX)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
@ -908,7 +908,7 @@ static int scd30_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_SET_FRC:
|
||||
{
|
||||
if (arg < 0 && arg > UINT16_MAX)
|
||||
if (arg > UINT16_MAX)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user