drivers/sensors/scd30: Fix invalid parameter check

Fix invalid parameter check and redundant conditions.
This commit is contained in:
SPRESENSE 2022-04-11 16:34:56 +09:00 committed by Petro Karashchenko
parent bf332cf888
commit 3787a362bf

View File

@ -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;